Commit 4b98597edc416d9f26198d7fddc34edadc6092e0
1 parent
ce1efb56
Exists in
master
and in
4 other branches
Add specs for Email confirmation
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
1 changed file
with
24 additions
and
0 deletions
Show diff stats
spec/mailers/notify_spec.rb
@@ -367,4 +367,28 @@ describe Notify do | @@ -367,4 +367,28 @@ describe Notify do | ||
367 | should have_body_text /#{membership.human_access}/ | 367 | should have_body_text /#{membership.human_access}/ |
368 | end | 368 | end |
369 | end | 369 | end |
370 | + | ||
371 | + describe 'confirmation if email changed' do | ||
372 | + let(:example_site_path) { root_path } | ||
373 | + let(:user) { create(:user, email: 'old-email@mail.com') } | ||
374 | + | ||
375 | + before do | ||
376 | + user.email = "new-email@mail.com" | ||
377 | + user.save | ||
378 | + end | ||
379 | + | ||
380 | + subject { ActionMailer::Base.deliveries.last } | ||
381 | + | ||
382 | + it 'is sent to the new user' do | ||
383 | + should deliver_to 'new-email@mail.com' | ||
384 | + end | ||
385 | + | ||
386 | + it 'has the correct subject' do | ||
387 | + should have_subject "Confirmation instructions" | ||
388 | + end | ||
389 | + | ||
390 | + it 'includes a link to the site' do | ||
391 | + should have_body_text /#{example_site_path}/ | ||
392 | + end | ||
393 | + end | ||
370 | end | 394 | end |