Skip to content

Commit

Permalink
Merge pull request #2830 from alphagov/dependabot/bundler/mail-notify…
Browse files Browse the repository at this point in the history
…-2.0.0

Bump mail-notify from 1.2.0 to 2.0.0
  • Loading branch information
callumknights authored Jul 31, 2024
2 parents 7905dd9 + 510b111 commit c44d4aa
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ GEM
net-imap
net-pop
net-smtp
mail-notify (1.2.0)
actionmailer (>= 5.2.4.6)
actionpack (>= 5.2.7.1)
actionview (>= 5.2.7.1)
activesupport (>= 5.2.4.6)
notifications-ruby-client (~> 5.1)
mail-notify (2.0.0)
actionmailer (>= 5.2.8.1)
actionpack (>= 5.2.8.1)
actionview (>= 5.2.8.1)
activesupport (>= 5.2.8.1)
notifications-ruby-client (~> 6.0)
rack (>= 2.1.4.1)
marcel (1.0.4)
matrix (0.4.2)
Expand Down Expand Up @@ -322,7 +322,7 @@ GEM
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
notifications-ruby-client (5.4.0)
notifications-ruby-client (6.0.0)
jwt (>= 1.5, < 3)
null_logger (0.0.1)
opentelemetry-api (1.3.0)
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/noisy_batch_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def make_noise(batch_invitation)
user_count = batch_invitation.batch_invitation_users.count
subject = "[SIGNON] #{@user.name} created a batch of #{user_count} users"
subject << " in #{GovukEnvironment.name}" unless GovukEnvironment.production?
view_mail(template_id, subject:)
view_mail(template_id, to: I18n.t("noisy_batch_invitation_mailer.to"), subject:)
end
end
12 changes: 10 additions & 2 deletions test/integration/email_change_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class EmailChangeTest < ActionDispatch::IntegrationTest
signin_with(@admin)
admin_changes_email_address(user:, new_email: "new@email.com")

email = emails_sent_to("new@email.com").detect { |mail| mail.subject == I18n.t("devise.mailer.invitation_instructions.subject") }
email = ActionMailer::Base
.deliveries
.detect { |mail| mail.to.include?("new@email.com") && mail.subject == I18n.t("devise.mailer.invitation_instructions.subject") }

assert email
assert email.body.include?("/users/invitation/accept?invitation_token=")
assert user.accept_invitation!
Expand Down Expand Up @@ -121,7 +124,12 @@ class EmailChangeTest < ActionDispatch::IntegrationTest
click_link "Change your email"
fill_in "Email", with: "new@email.com"
click_button "Change email"
confirmation_url = first_email_sent_to("new@email.com").find_link(href: false)[:href].sub(/\)$/, "")
confirmation_url = ActionMailer::Base
.deliveries
.detect { |mail| mail.to.include?("new@email.com") }
.body
.match(%r{\((https?://\S+)\)})[1]

visit confirmation_url

signout
Expand Down
2 changes: 1 addition & 1 deletion test/integration/password_reset_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class PasswordResetTest < ActionDispatch::IntegrationTest

signout

current_email.find_link(href: false).click
visit_password_reset_url_in(current_email)

assert_response_contains("Sorry, this link doesn't work")
end
Expand Down
2 changes: 1 addition & 1 deletion test/support/password_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def complete_password_reset(email, options)
end

def visit_password_reset_url_in(email)
reset_password_url = /\[Reset your password\.\]\((?<url>http.*)\)/.match(email.body).named_captures["url"]
reset_password_url = /\[Reset your password\.\]\((?<url>http.*)\)/.match(email.base.email.body.raw_source).named_captures["url"]
visit reset_password_url
end
end

0 comments on commit c44d4aa

Please sign in to comment.