2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-23 17:28:14 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-06-29 04:13:10 +00:00
|
|
|
describe 'Snippets' do
|
2016-09-23 17:28:14 +00:00
|
|
|
context 'when the project has snippets' do
|
2017-08-02 19:55:11 +00:00
|
|
|
let(:project) { create(:project, :public) }
|
2016-09-23 17:28:14 +00:00
|
|
|
let!(:snippets) { create_list(:project_snippet, 2, :public, author: project.owner, project: project) }
|
2019-12-06 03:08:02 +00:00
|
|
|
|
2016-09-23 17:28:14 +00:00
|
|
|
before do
|
|
|
|
allow(Snippet).to receive(:default_per_page).and_return(1)
|
2019-12-06 03:08:02 +00:00
|
|
|
|
|
|
|
visit project_snippets_path(project)
|
2016-09-23 17:28:14 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'paginated snippets'
|
|
|
|
end
|
2019-12-06 03:08:02 +00: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 17:28:14 +00:00
|
|
|
end
|