Hi Jack

Can you compare the versions of Gems between the two? Something like capybara 
or rack test might have changed which might have changed the default host used 
to emulate the browser behaviour...

Cheers
Jon
----------------
[email protected]
https://jonrowe.co.uk

On 21 October 2020 at 02:28, Jack Royal-Gordon wrote:
> 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 (http://test.host)’}”
> and "Rails.application.routes.default_url_options = {protocol: 'http', host: 
> 'test.host (http://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/dejalu-217-9a060c85-5373-4bdf-a695-f9c42933993e%40jonrowe.co.uk.

Reply via email to