From 20f564ee52eff726ee8e2342b7d9f845e7482153 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 18 Nov 2021 10:07:31 +0000 Subject: [PATCH] Email content is ascii encoded --- spec/requests/users/passwords_controller_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/requests/users/passwords_controller_spec.rb b/spec/requests/users/passwords_controller_spec.rb index 88e68658d..0da90d6e9 100644 --- a/spec/requests/users/passwords_controller_spec.rb +++ b/spec/requests/users/passwords_controller_spec.rb @@ -30,7 +30,7 @@ RSpec.describe Users::PasswordsController, type: :request do expect(response.body).to match(/Check your email/) end - + end context "when a password reset is requested the email" do @@ -40,8 +40,9 @@ RSpec.describe Users::PasswordsController, type: :request do it "should contain the correct email" do post "/users/password", params: params follow_redirect! - binding.pry - expect ( ActionMailer::Base.deliveries.last.body.raw_source ).to contain( email ) + email_ascii_content = ActionMailer::Base.deliveries.last.body.raw_source + email_content = email_ascii_content.encode("ASCII", "UTF-8", undef: :replace) + expect(email_content).to match(email) end end end