Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/mailers/notify_spec.rb')
-rw-r--r--spec/mailers/notify_spec.rb52
1 files changed, 48 insertions, 4 deletions
diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb
index f39037cf744..151f7473c5f 100644
--- a/spec/mailers/notify_spec.rb
+++ b/spec/mailers/notify_spec.rb
@@ -8,6 +8,7 @@ RSpec.describe Notify do
include EmailSpec::Matchers
include EmailHelpers
include RepoHelpers
+ include MembersHelper
include_context 'gitlab email notification'
@@ -761,10 +762,21 @@ RSpec.describe Notify do
is_expected.to have_body_text project_member.human_access
is_expected.to have_body_text 'leave the project'
is_expected.to have_body_text project_url(project, leave: 1)
+ is_expected.not_to have_body_text 'You were assigned the following tasks:'
+ end
+
+ context 'with tasks to be done present' do
+ let(:project_member) { create(:project_member, project: project, user: user, tasks_to_be_done: [:ci, :code]) }
+
+ it 'contains the assigned tasks to be done' do
+ is_expected.to have_body_text 'You were assigned the following tasks:'
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:ci]
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:code]
+ end
end
end
- def invite_to_project(project, inviter:, user: nil)
+ def invite_to_project(project, inviter:, user: nil, tasks_to_be_done: [])
create(
:project_member,
:developer,
@@ -772,7 +784,8 @@ RSpec.describe Notify do
invite_token: '1234',
invite_email: 'toto@example.com',
user: user,
- created_by: inviter
+ created_by: inviter,
+ tasks_to_be_done: tasks_to_be_done
)
end
@@ -804,6 +817,7 @@ RSpec.describe Notify do
is_expected.to have_content("#{inviter.name} invited you to join the")
is_expected.to have_content('Project details')
is_expected.to have_content("What's it about?")
+ is_expected.not_to have_body_text 'and has assigned you the following tasks:'
end
end
@@ -890,6 +904,16 @@ RSpec.describe Notify do
end
end
end
+
+ context 'with tasks to be done present', :aggregate_failures do
+ let(:project_member) { invite_to_project(project, inviter: inviter, tasks_to_be_done: [:ci, :code]) }
+
+ it 'contains the assigned tasks to be done' do
+ is_expected.to have_body_text 'and has assigned you the following tasks:'
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:ci]
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:code]
+ end
+ end
end
describe 'project invitation accepted' do
@@ -1398,7 +1422,7 @@ RSpec.describe Notify do
end
end
- def invite_to_group(group, inviter:, user: nil)
+ def invite_to_group(group, inviter:, user: nil, tasks_to_be_done: [])
create(
:group_member,
:developer,
@@ -1406,7 +1430,8 @@ RSpec.describe Notify do
invite_token: '1234',
invite_email: 'toto@example.com',
user: user,
- created_by: inviter
+ created_by: inviter,
+ tasks_to_be_done: tasks_to_be_done
)
end
@@ -1431,6 +1456,7 @@ RSpec.describe Notify do
is_expected.to have_body_text group.name
is_expected.to have_body_text group_member.human_access.downcase
is_expected.to have_body_text group_member.invite_token
+ is_expected.not_to have_body_text 'and has assigned you the following tasks:'
end
end
@@ -1444,6 +1470,24 @@ RSpec.describe Notify do
is_expected.to have_body_text group_member.invite_token
end
end
+
+ context 'with tasks to be done present', :aggregate_failures do
+ let(:group_member) { invite_to_group(group, inviter: inviter, tasks_to_be_done: [:ci, :code]) }
+
+ it 'contains the assigned tasks to be done' do
+ is_expected.to have_body_text 'and has assigned you the following tasks:'
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:ci]
+ is_expected.to have_body_text localized_tasks_to_be_done_choices[:code]
+ end
+
+ context 'when there is no inviter' do
+ let(:inviter) { nil }
+
+ it 'does not contain the assigned tasks to be done' do
+ is_expected.not_to have_body_text 'and has assigned you the following tasks:'
+ end
+ end
+ end
end
describe 'group invitation reminders' do