How to set HTTP Headers with Rspec3 ??

47 views
Skip to first unread message

AndyL

unread,
Jun 2, 2014, 4:44:01 PM6/2/14
to rs...@googlegroups.com
To test subdomains in rspec2, I used a line like 'request.host = "#{@subdomain}.testdomain.com" ' in a before(:each) clause.

With rspec3, it looks like there is no request object.  How can I setup custom subdomains using rspec3 ??

AndyL

unread,
Jun 2, 2014, 8:42:02 PM6/2/14
to rs...@googlegroups.com
I was able to work around this problem by adding ':type => :controller' to my controller specs.  Now everything works as before.

BTW - the problem spec resided under the "spec/controllers" directory.  In rspec2 the ':type => :controller' parameter was set automatically.

AndyL

unread,
Jun 2, 2014, 9:26:58 PM6/2/14
to rs...@googlegroups.com
Another note - had to add ":type => :view" and ":type => :feature" to get view and feature specs working.

Using Rails 4.0 and Ruby 2.1.1

AndyL

unread,
Jun 3, 2014, 11:49:37 AM6/3/14
to rs...@googlegroups.com
So I just read the release notes, and learned that I needed to use this setting...

  config.infer_spec_type_from_file_location!
Reply all
Reply to author
Forward
0 new messages