kasugaijin / baja-pet-rescue

Kasugaijin's open-source Ruby on Rails production app that enables dog rescue organisation staff in Mexico to post dogs and receive applications for adoption from users in USA and Canada..
27 stars 9 forks source link

Test an email is sent when a user goes through the Forgot Password flow #86

Closed Overlandcoder closed 1 year ago

Overlandcoder commented 1 year ago

Closes #81

I added the default URL options for the test environment because of this error that kept popping up when trying to run this test:

Error:
UserAccountTest#test_email_is_sent_when_a_user_goes_through_Forgot_Password_flow:
ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true
    app/views/devise/mailer/reset_password_instructions.html.erb:5
    test/integration/user_account_test.rb:195:in `block in <class:UserAccountTest>'

which was being caused by this link in app/views/devise/mailer/reset_password_instructions.html.erb:

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>

Hopefully the test itself is ok. I've never written mailer tests before, so I just used the other tests in this file as guidance.

kasugaijin commented 1 year ago

Looks good!