[rspec-users] Testing subdomains

Nicholas Wieland nicholas.wieland at gmail.com
Wed Jul 28 21:16:42 EDT 2010


On Jul 27, 2010, at 6:40 PM, Nicholas Wieland wrote:

> Hi *, is someone using rspec 2 and rails 3 for testing subdomains ? How do I test for example in a route spec tis route ?
> 
>  match 'profile', :to => 'users#profile', :constraints => { :subdomain => /.+/ }

  it "routes /profile to UsersController#profile for slug" do
    { :get => "profile" }.should route_to(
      :controller => :users, :action => :profile, :permalink => 'test' )
  end

This fails with 

undefined method `subdomain' for #<Rack::Request:0x102fd16e8>

I'm not able to set the host, host! doesn't work, or I'm using it in the wrong way.

Someone has any idea ?

  ngw


More information about the rspec-users mailing list