2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-23 13:28:14 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 00:13:10 -04:00
|
|
|
describe 'Snippets' do
|
2016-09-23 13:28:14 -04:00
|
|
|
context 'when the project has snippets' do
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, :public) }
|
2016-09-23 13:28:14 -04:00
|
|
|
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
|
2019-12-05 22:08:02 -05:00
|
|
|
|
2016-09-23 13:28:14 -04:00
|
|
|
before do
|
|
|
|
allow(Snippet).to receive(:default_per_page).and_return(1)
|
2019-12-05 22:08:02 -05:00
|
|
|
|
|
|
|
visit project_snippets_path(project)
|
2016-09-23 13:28:14 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'paginated snippets'
|
|
|
|
end
|
2019-12-05 22:08:02 -05:00
|
|
|
|
|
|
|
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: snippets_vue_feature_flag_enabled)
|
|
|
|
|
|
|
|
visit snippet_path(snippet)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'renders Vue application' do
|
|
|
|
expect(page).to have_selector('#js-snippet-view')
|
|
|
|
expect(page).not_to have_selector('.personal-snippets')
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'when feature flag is disabled' do
|
|
|
|
let(:snippets_vue_feature_flag_enabled) { false }
|
|
|
|
|
|
|
|
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
|
2016-09-23 13:28:14 -04:00
|
|
|
end
|