This is a stupid one. When I moved my app using RSpec 3.9 from Ruby 2.0/Rails 
4.2 to Ruby 2.2/Rails 4.2, some of my tests died with a very stupid error of 
the form:

        Expected response to be a redirect to <http://test.host/> but was a 
redirect to <http://localhost/>

I tried adding "config.action_controller.default_url_options = {protocol: 
'http', host: 'test.host’}”
and "Rails.application.routes.default_url_options = {protocol: 'http', host: 
'test.host’}”
with no change in behavior.

My test looks like: expect(response).to redirect_to(app_path.root_path)

where app_path has the following definition in spec_helper.rb:
  def app_path
    Rails.application.routes.url_helpers
  end

Note, by the way that I’m using #root_path and yet I’m getting a host in the 
URL; not sure why that is.

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/CD5EA37F-8B3B-4B54-8052-8F58CD162505%40pobox.com.

Reply via email to