diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 18:05:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-21 18:05:58 +0300 |
commit | ad1e4b8fb8104b642fa79ed34fd144bc2bed8a19 (patch) | |
tree | 78f95d63d4ea5ed0b1a8b3c83c38d9cbd682f884 /spec/views | |
parent | 664c4c7b49c6056136299817eb79e9f1de83e567 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/projects/show.html.haml_spec.rb | 41 | ||||
-rw-r--r-- | spec/views/projects/tree/show.html.haml_spec.rb | 45 |
2 files changed, 75 insertions, 11 deletions
diff --git a/spec/views/projects/show.html.haml_spec.rb b/spec/views/projects/show.html.haml_spec.rb new file mode 100644 index 00000000000..820772b592f --- /dev/null +++ b/spec/views/projects/show.html.haml_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'projects/show' do + include Devise::Test::ControllerHelpers + + let(:user) { create(:admin) } + let(:project) { create(:project, :repository) } + + before do + presented_project = project.present(current_user: user) + + allow(presented_project).to receive(:default_view).and_return('customize_workflow') + allow(controller).to receive(:current_user).and_return(user) + + assign(:project, presented_project) + end + + context 'commit signatures' do + context 'with vue tree view disabled' do + before do + stub_feature_flags(vue_file_list: false) + end + + it 'rendered via js-signature-container' do + render + + expect(rendered).to have_css('.js-signature-container') + end + end + + context 'with vue tree view enabled' do + it 'are not rendered via js-signature-container' do + render + + expect(rendered).not_to have_css('.js-signature-container') + end + end + end +end diff --git a/spec/views/projects/tree/show.html.haml_spec.rb b/spec/views/projects/tree/show.html.haml_spec.rb index 960cf42a793..4307d1b49c9 100644 --- a/spec/views/projects/tree/show.html.haml_spec.rb +++ b/spec/views/projects/tree/show.html.haml_spec.rb @@ -7,6 +7,10 @@ describe 'projects/tree/show' do let(:project) { create(:project, :repository) } let(:repository) { project.repository } + let(:ref) { 'master' } + let(:commit) { repository.commit(ref) } + let(:path) { '' } + let(:tree) { repository.tree(commit.id, path) } before do stub_feature_flags(vue_file_list: false) @@ -19,26 +23,45 @@ describe 'projects/tree/show' do allow(view).to receive(:can_collaborate_with_project?).and_return(true) allow(view).to receive_message_chain('user_access.can_push_to_branch?').and_return(true) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) + allow(view).to receive(:current_user).and_return(project.creator) + + assign(:id, File.join(ref, path)) + assign(:ref, ref) + assign(:path, path) + assign(:last_commit, commit) + assign(:tree, tree) end context 'for branch names ending on .json' do let(:ref) { 'ends-with.json' } - let(:commit) { repository.commit(ref) } - let(:path) { '' } - let(:tree) { repository.tree(commit.id, path) } - - before do - assign(:id, File.join(ref, path)) - assign(:ref, ref) - assign(:path, path) - assign(:last_commit, commit) - assign(:tree, tree) - end it 'displays correctly' do render + expect(rendered).to have_css('.js-project-refs-dropdown .dropdown-toggle-text', text: ref) expect(rendered).to have_css('.readme-holder') end end + + context 'commit signatures' do + context 'with vue tree view disabled' do + it 'rendered via js-signature-container' do + render + + expect(rendered).to have_css('.js-signature-container') + end + end + + context 'with vue tree view enabled' do + before do + stub_feature_flags(vue_file_list: true) + end + + it 'are not rendered via js-signature-container' do + render + + expect(rendered).not_to have_css('.js-signature-container') + end + end + end end |