diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 12:09:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-26 12:09:57 +0300 |
commit | e48c28ed86567f049865a590fdda4569a760ee1f (patch) | |
tree | 9925303b549d10a8df95d525495e37c03991f3db /spec/mailers/notify_spec.rb | |
parent | a2c7a6bbd5550fa5c0cbc8b9a55b0a828f0e6d37 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/mailers/notify_spec.rb')
-rw-r--r-- | spec/mailers/notify_spec.rb | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index 151f7473c5f..a5e3350ec2e 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -721,11 +721,8 @@ RSpec.describe Notify do end describe 'project access denied' do - let(:project) { create(:project, :public) } - let(:project_member) do - project.request_access(user) - project.requesters.find_by(user_id: user.id) - end + let_it_be(:project) { create(:project, :public) } + let_it_be(:project_member) { create(:project_member, :developer, :access_request, user: user, source: project) } subject { described_class.member_access_denied_email('project', project.id, user.id) } @@ -740,6 +737,17 @@ RSpec.describe Notify do is_expected.to have_body_text project.full_name is_expected.to have_body_text project.web_url end + + context 'when user can not read project' do + let_it_be(:project) { create(:project, :private) } + + it 'hides project name from subject and body' do + is_expected.to have_subject "Access to the Hidden project was denied" + is_expected.to have_body_text "Hidden project" + is_expected.not_to have_body_text project.full_name + is_expected.not_to have_body_text project.web_url + end + end end describe 'project access changed' do @@ -1375,10 +1383,8 @@ RSpec.describe Notify do end describe 'group access denied' do - let(:group_member) do - group.request_access(user) - group.requesters.find_by(user_id: user.id) - end + let_it_be(:group) { create(:group, :public) } + let_it_be(:group_member) { create(:group_member, :developer, :access_request, user: user, source: group) } let(:recipient) { user } @@ -1396,6 +1402,17 @@ RSpec.describe Notify do is_expected.to have_body_text group.name is_expected.to have_body_text group.web_url end + + context 'when user can not read group' do + let_it_be(:group) { create(:group, :private) } + + it 'hides group name from subject and body' do + is_expected.to have_subject "Access to the Hidden group was denied" + is_expected.to have_body_text "Hidden group" + is_expected.not_to have_body_text group.name + is_expected.not_to have_body_text group.web_url + end + end end describe 'group access changed' do |