GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Not sure what I'm doing wrong but getting different hosts on _url methods (worked around that now) and other different behaviour.
I am currently testing on Rail 4 head (revision: 70d0537d5550958d7e006787de869ce9046101fc) and rspec-rails 2.13.0.
The _url methods are returning the URL with the host part test.host when run from 'rspec spec/' but (correctly) www.example.com when run with 'rspec spec/features'.
I think I've got round whatever the issue is by using _path methods instead of _url methods but am still surprised/puzzled by the difference in behaviour depending on how I run the test. 'rspec spec/' -> test.host and 'rspec spec/features/' -> www.example.com.
Thanks for your report.
Unfortunately I'm unable to reproduce it. I created a new Rails 3.2.13 application, brought in rspec-rails 2.13, and created a feature spec that simply prints out posts_url (I had scaffolded a Post model). It used example.com when I ran both rspec spec and rspec spec/features.
Are you able to distill what you're seeing down to an application you can push to GitHub? If so, I'd be happy to dig deeper.
That said, I think it's best to test on _path in these sorts of specs since the hostname is not relevant as far as I can tell.