debian-mirror-gitlab/spec/features/snippets_spec.rb

44 lines
1.2 KiB
Ruby
Raw Normal View History

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