Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:16:06+00:00 2026-05-29T15:16:06+00:00

I have the following Rspec test: it Password reset instructions do user = Factory(:user)

  • 0

I have the following Rspec test:

it "Password reset instructions" do
    user = Factory(:user)
    user.send_reset_password_instructions

    email = last_email

    email.body.encoded.should match(edit_user_password_url(:reset_password_token => user.reset_password_token))
end

Trying to match the edit_password_url in a mailer

!!!
%html
  %head
    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
  %body
    %h1 Hey #{@resource.first_name}
    %p Forget your password? Its cool-- it happens to the best of us.
    %p To reset the password to your TippingPress account, click the link below:
    %p= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token)
    %p If you didn’t request a password change, you can email us at support@tippingpress.com.
    %p Best,
    %p 
      Alex & Larson
      %br  
      = link_to "TippingPress.com", "http://www.tippingpress.com"

I get the following error:

  1) UserMailer Password reset instructions
     Failure/Error: email.body.encoded.should match(edit_user_password_url(:reset_password_token => user.reset_password_token))
       expected "<!DOCTYPE html>\r\n<html>\r\n<head>\r\n<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'>\r\n</head>\r\n<body>\r\n<h1>Hey Tester</h1>\r\n<p>Forget your password? Its cool-- it happens to the best of us.</p>\r\n<p>To reset the password to your TippingPress account, click the link below:</p>\r\n<p><a href=\"http://localhost:3000/users/password/edit?reset_password_token=8RMhiAxsRihME1mL7JiE\">Change my password</a></p>\r\n<p>If you didn’t request a password change, you can email us at support@tippingpress.com.</p>\r\n<p>Best,</p>\r\n<p>\r\nAlex & Larson\r\n<br>\r\n<a href=\"http://www.tippingpress.com\">TippingPress.com</a>\r\n</p>\r\n</body>\r\n</html>\r\n" to match "http://localhost:3000/users/password/edit?reset_password_token=8RMhiAxsRihME1mL7JiE"

Seems like the two urls match, I’m assuming this is some kind of error due to my lack of knowledge of REGEX or character encoding. Thank you in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:16:08+00:00Added an answer on May 29, 2026 at 3:16 pm

    Indeed, you’re not passing a regexp to the match method, but a mere string.

    You’d better do:

    email.body.encoded.should include(edit_user_password_url(:reset_password_token => user.reset_password_token))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following Rspec test: describe Productlimit do before(:each) do @productlimit = Factory.create(:productlimit, :user
I have the following RSpec example which is passing: describe UsersController do it should
My rspec title test is failing with: 1) HomeController Get 'index should have the
If I have rspec test like following: context main context do before(:all) do #
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I am writing rspec test for my Cars class, and have a question regarding
I'm running Rails 3.1.1, RSpec 2.7.0 and HAML 3.1.3. Say I have the following
I have a Rails 3.0.7 application. In the functional test I have following code.
I have a suite of RSpec tests I want to group under the following
I have written some Rspec test cases in my spec/models/season_spec.rb file. They are as:-

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.