Commit 6e032f66 authored by Francisco Javier López's avatar Francisco Javier López Committed by Denys Mishunov

Fixed feature spec

parent cf2e06aa
......@@ -6,41 +6,38 @@ describe 'Snippets' do
context 'when the project has snippets' do
let(:project) { create(:project, :public) }
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
before do
allow(Snippet).to receive(:default_per_page).and_return(1)
visit snippets_path(username: project.owner.username)
visit project_snippets_path(project)
end
it_behaves_like 'paginated snippets'
end
describe 'when feature flag is enabled' do
let(:user) { create(:user) }
let!(:snippets) { create(:personal_snippet, :public, author: user) }
describe 'rendering engine' do
let_it_be(:snippet) { create(:personal_snippet, :public) }
let(:snippets_vue_feature_flag_enabled) { true }
before do
stub_feature_flags(snippets_vue: true)
visit snippet_path(1)
stub_feature_flags(snippets_vue: snippets_vue_feature_flag_enabled)
visit snippet_path(snippet)
end
it 'should render Vue application' do
it 'renders Vue application' do
expect(page).to have_selector('#js-snippet-view')
expect(page).not_to have_selector('.personal-snippets')
end
end
describe 'when feature flag is disabled' do
let(:user) { create(:user) }
let!(:snippets) { create(:personal_snippet, :public, author: user) }
before do
stub_feature_flags(snippets_vue: false)
visit snippet_path(1)
end
context 'when feature flag is disabled' do
let(:snippets_vue_feature_flag_enabled) { false }
it 'should render HAML application and not Vue' do
expect(page).not_to have_selector('#js-snippet-view')
expect(page).to have_selector('.personal-snippets')
it 'renders HAML application and not Vue' do
expect(page).not_to have_selector('#js-snippet-view')
expect(page).to have_selector('.personal-snippets')
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment