Testing subdomains on Rails 3

Hi *, I’m trying to use subdomains on Rails 3, but haven’t been able to
test the behaviour:

it “routes ‘http://test.example.com/dashboard’ to
UsersController#show with subdomain ‘test’” do
{ :get => ‘http://test.example.com/dashboard’ }.should route_to(
:controller => ‘users’, :action => ‘show’, :subdomain => ‘test’ )
end

My route is:

constraints( :subdomain => /.+/ ) do
match ‘/dashboard’ => ‘users#show’
end

The test fails like this:

The recognized options <{“action”=>“show”, “controller”=>“users”}>
did not match <{“action”=>“show”, “subdomain”=>“test”,
“controller”=>“users”}>, difference: <{“subdomain”=>“test”}>

I found many references to this syntax and usage on Google, but even
from console the subdomain is only in the request object.
Someone managed to do something like this and can share ?
I’ve also tried to use subdomain-fu, but no success so far

ngw

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs