[rspec-users] stricter routing specs with conditional routes

max@gorbul.net likonar at gmail.com
Tue Mar 24 16:21:48 EDT 2009


Hello,

could you please advise me how to test conditional routes with rspec
v1.2.0 ?
I have something like the following in my application.
------------
map.with_options(:namespace => "admin/",
                  :conditions => { :subdomain => /^admin$/i },
                  :name_prefix => "admin_") do |admin|
   admin.resources(:users)
   admin.resources(:messages)
end
------------
Before 1.2.0 all specs run without failures. After I upgraded to rails
2.3 with rspec 1.2.0 I got a ton of failed spec related to mismatched
routes:

route_for(:controller => "admin/users", :id=>"1", :action =>
"create").
   should == {:path => "/admin/users/1", :method => :post}

this spec is failed because :subdomain => nil

How to deal with such issue?

Thank you,
Max


More information about the rspec-users mailing list