I'm trying to test the password recovery using rspec/capybara using email_spec
My test.rb contains:
config.action_mailer.delivery_method = :test
My test goes like this:
feature User do
let!(:user){ FactoryGirl.build(:user) }
before(:each) do
visit root_path
click_link "Sign up/in"
end
scenario "recover password" do
user.save!
click_link "Forgot password?"
fill_in "Email", :with => user.email
click_button "Send me reset password instructions"
unread_emails_for(user.email).should be_present
end
My test fails like so:
1) User recover password
Failure/Error: click_button "Send me reset password instructions"
ActionView::Template::Error:
Missing host to link to! Please provide the :host parameter,
set default_url_options[:host], or set :only_path to true
If I set the default_url_options, rspec tries to send the mail. I'm not too sure about :only_path.
Can anyone please point me in the right direction? Many thanks.