Commit 4abca08f authored by Robert Speicher's avatar Robert Speicher

Move the `a new user email` shared example to the Emails::Profile spec

This shared example was only used by this spec so having it in a
separate file provided no benefit, at the cost of clarity. This also
reduces the three `it` blocks into a single test with
`aggregate_failures`.
parent 45a2f900
...@@ -5,6 +5,16 @@ describe Notify do ...@@ -5,6 +5,16 @@ describe Notify do
include EmailSpec::Matchers include EmailSpec::Matchers
include_context 'gitlab email notification' include_context 'gitlab email notification'
shared_examples 'a new user email' do
it 'is sent to the new user with the correct subject and body' do
aggregate_failures do
is_expected.to deliver_to new_user_address
is_expected.to have_subject(/^Account was created for you$/i)
is_expected.to have_body_text(new_user_address)
end
end
end
describe 'profile notifications' do describe 'profile notifications' do
describe 'for new users, the email' do describe 'for new users, the email' do
let(:example_site_path) { root_path } let(:example_site_path) { root_path }
......
...@@ -136,20 +136,6 @@ shared_examples 'an answer to an existing thread with reply-by-email enabled' do ...@@ -136,20 +136,6 @@ shared_examples 'an answer to an existing thread with reply-by-email enabled' do
end end
end end
shared_examples 'a new user email' do
it 'is sent to the new user' do
is_expected.to deliver_to new_user_address
end
it 'has the correct subject' do
is_expected.to have_subject /^Account was created for you$/i
end
it 'contains the new user\'s login name' do
is_expected.to have_body_text /#{new_user_address}/
end
end
shared_examples 'it should have Gmail Actions links' do shared_examples 'it should have Gmail Actions links' do
it { is_expected.to have_body_text '<script type="application/ld+json">' } it { is_expected.to have_body_text '<script type="application/ld+json">' }
it { is_expected.to have_body_text /ViewAction/ } it { is_expected.to have_body_text /ViewAction/ }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment