diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 13:49:51 +0000 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/views/projects | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) | |
download | gitlab-ce-15.9.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/views/projects')
-rw-r--r-- | spec/views/projects/commit/show.html.haml_spec.rb | 4 | ||||
-rw-r--r-- | spec/views/projects/commits/_commit.html.haml_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/projects/issues/_issue.html.haml_spec.rb | 53 | ||||
-rw-r--r-- | spec/views/projects/merge_requests/_commits.html.haml_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb | 2 | ||||
-rw-r--r-- | spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb | 5 | ||||
-rw-r--r-- | spec/views/projects/project_members/index.html.haml_spec.rb | 6 | ||||
-rw-r--r-- | spec/views/projects/runners/_project_runners.html.haml_spec.rb (renamed from spec/views/projects/runners/_specific_runners.html.haml_spec.rb) | 10 |
8 files changed, 69 insertions, 15 deletions
diff --git a/spec/views/projects/commit/show.html.haml_spec.rb b/spec/views/projects/commit/show.html.haml_spec.rb index 52b3d5b95f9..eba54628215 100644 --- a/spec/views/projects/commit/show.html.haml_spec.rb +++ b/spec/views/projects/commit/show.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code do +RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code_management do let(:project) { create(:project, :repository) } let(:commit) { project.commit } @@ -79,7 +79,7 @@ RSpec.describe 'projects/commit/show.html.haml', feature_category: :source_code context 'when commit is signed' do let(:page) { Nokogiri::HTML.parse(rendered) } - let(:badge) { page.at('.gpg-status-box') } + let(:badge) { page.at('.signature-badge') } let(:badge_attributes) { badge.attributes } let(:title) { badge_attributes['data-title'].value } let(:content) { badge_attributes['data-content'].value } diff --git a/spec/views/projects/commits/_commit.html.haml_spec.rb b/spec/views/projects/commits/_commit.html.haml_spec.rb index 4e8a680b6de..90df0d381ed 100644 --- a/spec/views/projects/commits/_commit.html.haml_spec.rb +++ b/spec/views/projects/commits/_commit.html.haml_spec.rb @@ -39,7 +39,7 @@ RSpec.describe 'projects/commits/_commit.html.haml' do commit: commit } - within '.gpg-status-box' do + within '.signature-badge' do expect(page).not_to have_css('.gl-spinner') end end diff --git a/spec/views/projects/issues/_issue.html.haml_spec.rb b/spec/views/projects/issues/_issue.html.haml_spec.rb index 29bef557304..e4485f253b6 100644 --- a/spec/views/projects/issues/_issue.html.haml_spec.rb +++ b/spec/views/projects/issues/_issue.html.haml_spec.rb @@ -37,6 +37,59 @@ RSpec.describe 'projects/issues/_issue.html.haml' do end end + context 'when issue is service desk issue' do + let_it_be(:email) { 'user@example.com' } + let_it_be(:obfuscated_email) { 'us*****@e*****.c**' } + let_it_be(:issue) { create(:issue, author: User.support_bot, service_desk_reply_to: email) } + + context 'with anonymous user' do + it 'obfuscates service_desk_reply_to email for anonymous user' do + expect(rendered).to have_content(obfuscated_email) + end + end + + context 'with signed in user' do + let_it_be(:user) { create(:user) } + + before do + allow(view).to receive(:current_user).and_return(user) + allow(view).to receive(:issue).and_return(issue) + end + + context 'when user has no role in project' do + it 'obfuscates service_desk_reply_to email' do + render + + expect(rendered).to have_content(obfuscated_email) + end + end + + context 'when user has guest role in project' do + before do + issue.project.add_guest(user) + end + + it 'obfuscates service_desk_reply_to email' do + render + + expect(rendered).to have_content(obfuscated_email) + end + end + + context 'when user has (at least) reporter role in project' do + before do + issue.project.add_reporter(user) + end + + it 'shows full service_desk_reply_to email' do + render + + expect(rendered).to have_content(email) + end + end + end + end + def format_timestamp(time) l(time, format: "%b %d, %Y") end diff --git a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb index 90ee6638142..4ce6755b89d 100644 --- a/spec/views/projects/merge_requests/_commits.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/_commits.html.haml_spec.rb @@ -37,6 +37,6 @@ RSpec.describe 'projects/merge_requests/_commits.html.haml', :sidekiq_might_not_ it 'shows signature verification badge' do render - expect(rendered).to have_css('.gpg-status-box') + expect(rendered).to have_css('.js-loading-signature-badge') end end diff --git a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb index feb82e6a2b2..38f4daf7feb 100644 --- a/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb +++ b/spec/views/projects/merge_requests/creations/_new_submit.html.haml_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'projects/merge_requests/creations/_new_submit.html.haml' do +RSpec.describe 'projects/merge_requests/creations/_new_submit.html.haml', feature_category: :code_review_workflow do let(:merge_request) { create(:merge_request) } let!(:pipeline) { create(:ci_empty_pipeline) } diff --git a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb index 7886a811c9a..d604eb2c8d6 100644 --- a/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb +++ b/spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb @@ -17,7 +17,7 @@ RSpec.describe 'projects/notes/_more_actions_dropdown' do it 'shows Report abuse to admin button if not editable and not current users comment' do render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: false, note: note - expect(rendered).to have_link('Report abuse to administrator') + expect(rendered).to have_selector('.js-report-abuse-dropdown-item') end it 'does not show the More actions button if not editable and current users comment' do @@ -29,7 +29,8 @@ RSpec.describe 'projects/notes/_more_actions_dropdown' do it 'shows Report abuse and Delete buttons if editable and not current users comment' do render 'projects/notes/more_actions_dropdown', current_user: not_author_user, note_editable: true, note: note - expect(rendered).to have_link('Report abuse to administrator') + expect(rendered).to have_selector('.js-report-abuse-dropdown-item') + expect(rendered).to have_link('Delete comment') end diff --git a/spec/views/projects/project_members/index.html.haml_spec.rb b/spec/views/projects/project_members/index.html.haml_spec.rb index 382d400b961..4c4cde01cca 100644 --- a/spec/views/projects/project_members/index.html.haml_spec.rb +++ b/spec/views/projects/project_members/index.html.haml_spec.rb @@ -2,9 +2,9 @@ require 'spec_helper' -RSpec.describe 'projects/project_members/index', :aggregate_failures do - let_it_be(:user) { create(:user) } - let_it_be(:project) { create(:project, :empty_repo, :with_namespace_settings).present(current_user: user) } +RSpec.describe 'projects/project_members/index', :aggregate_failures, feature_category: :projects do + let_it_be(:user) { create(:user) } # rubocop:todo RSpec/FactoryBot/AvoidCreate + let_it_be(:project) { create(:project, :empty_repo, :with_namespace_settings).present(current_user: user) } # rubocop:todo RSpec/FactoryBot/AvoidCreate before do allow(view).to receive(:project_members_app_data_json).and_return({}) diff --git a/spec/views/projects/runners/_specific_runners.html.haml_spec.rb b/spec/views/projects/runners/_project_runners.html.haml_spec.rb index ce16e0d5ac6..8a7e693bdeb 100644 --- a/spec/views/projects/runners/_specific_runners.html.haml_spec.rb +++ b/spec/views/projects/runners/_project_runners.html.haml_spec.rb @@ -2,10 +2,10 @@ require 'spec_helper' -RSpec.describe 'projects/runners/specific_runners.html.haml' do +RSpec.describe 'projects/runners/_project_runners.html.haml', feature_category: :runner do describe 'render' do - let_it_be(:user) { create(:user) } - let_it_be(:project) { create(:project) } + let_it_be(:user) { build(:user) } + let_it_be(:project) { build(:project) } before do @project = project @@ -22,7 +22,7 @@ RSpec.describe 'projects/runners/specific_runners.html.haml' do end it 'enables the Remove project button for a project' do - render 'projects/runners/specific_runners', project: project + render 'projects/runners/project_runners', project: project expect(rendered).to have_selector '#js-install-runner' expect(rendered).not_to have_content 'Please contact an admin to register runners.' @@ -35,7 +35,7 @@ RSpec.describe 'projects/runners/specific_runners.html.haml' do end it 'does not enable the Remove project button for a project' do - render 'projects/runners/specific_runners', project: project + render 'projects/runners/project_runners', project: project expect(rendered).to have_content 'Please contact an admin to register runners.' expect(rendered).not_to have_selector '#js-install-runner' |