diff options
Diffstat (limited to 'spec/views/projects')
-rw-r--r-- | spec/views/projects/_files.html.haml_spec.rb | 73 | ||||
-rw-r--r-- | spec/views/projects/commit/show.html.haml_spec.rb | 7 | ||||
-rw-r--r-- | spec/views/projects/edit.html.haml_spec.rb | 6 |
3 files changed, 4 insertions, 82 deletions
diff --git a/spec/views/projects/_files.html.haml_spec.rb b/spec/views/projects/_files.html.haml_spec.rb deleted file mode 100644 index b6a8b4735b0..00000000000 --- a/spec/views/projects/_files.html.haml_spec.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'projects/_files' do - include ProjectForksHelper - - let_it_be(:user) { create(:user) } - let_it_be(:source_project) { create(:project, :repository, :public) } - - context 'when the project is a fork' do - let_it_be(:project) { fork_project(source_project, user, { repository: true }) } - - before do - assign(:project, project) - assign(:ref, project.default_branch) - assign(:path, '/') - assign(:id, project.commit.id) - - allow(view).to receive(:current_user).and_return(user) - end - - context 'when user can read fork source' do - before do - allow(view).to receive(:can?).with(user, :read_project, source_project).and_return(true) - end - - it 'shows the forked-from project' do - render - - expect(rendered).to have_content("Forked from #{source_project.full_name}") - expect(rendered).to have_content("Up to date with upstream repository") - end - - context 'when fork_divergence_counts is disabled' do - before do - stub_feature_flags(fork_divergence_counts: false) - end - - it 'does not show fork info' do - render - - expect(rendered).not_to have_content("Forked from #{source_project.full_name}") - expect(rendered).not_to have_content("Up to date with upstream repository") - end - end - end - - context 'when user cannot read fork source' do - before do - allow(view).to receive(:can?).with(user, :read_project, source_project).and_return(false) - end - - it 'does not show the forked-from project' do - render - - expect(rendered).to have_content("Forked from an inaccessible project") - end - - context 'when fork_divergence_counts is disabled' do - before do - stub_feature_flags(fork_divergence_counts: false) - end - - it 'does not show fork info' do - render - - expect(rendered).not_to have_content("Forked from an inaccessible project") - end - end - end - end -end diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index 1d9e5e782e5..52b3d5b95f9 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -92,7 +92,7 @@ RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code let(:commit) { project.commit(GpgHelpers::SIGNED_COMMIT_SHA) } it 'renders unverified badge' do - expect(title).to include('This commit was signed with an <strong>unverified</strong> signature.') + expect(title).to include('This commit was signed with an unverified signature.') expect(content).to include(commit.signature.gpg_key_primary_keyid) end end @@ -101,8 +101,8 @@ RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code let(:commit) { project.commit('7b5160f9bb23a3d58a0accdbe89da13b96b1ece9') } it 'renders unverified badge' do - expect(title).to include('This commit was signed with an <strong>unverified</strong> signature.') - expect(content).to match(/SSH key fingerprint:[\s\S]+Unknown/) + expect(title).to include('This commit was signed with an unverified signature.') + expect(content).to match(/SSH key fingerprint:[\s\S].+#{commit.signature.key_fingerprint_sha256}/) end end @@ -112,7 +112,6 @@ RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code it 'renders unverified badge' do expect(title).to include('This commit was signed with an <strong>unverified</strong> signature.') expect(content).to include(commit.signature.x509_certificate.subject_key_identifier.tr(":", " ")) - expect(content).to include(commit.signature.x509_certificate.email) end end end diff --git a/spec/views/projects/edit.html.haml_spec.rb b/spec/views/projects/edit.html.haml_spec.rb index 2935e4395ba..bf154b61609 100644 --- a/spec/views/projects/edit.html.haml_spec.rb +++ b/spec/views/projects/edit.html.haml_spec.rb @@ -93,13 +93,9 @@ RSpec.describe 'projects/edit' do it_behaves_like 'does not render registration features prompt', :project_disabled_repository_size_limit end - context 'with no license and service ping disabled' do + context 'with no license and service ping disabled', :without_license do before do stub_application_setting(usage_ping_enabled: false) - - if Gitlab.ee? - allow(License).to receive(:current).and_return(nil) - end end it_behaves_like 'renders registration features prompt', :project_disabled_repository_size_limit |