max@gorbul.net
2009-Mar-24 20:21 UTC
[rspec-users] stricter routing specs with conditional routes
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
Maksim Horbul
2009-Jul-10 17:34 UTC
[rspec-users] stricter routing specs with conditional routes
Here is the solution for that issue:
it "should map {:action => ''edit''} to
/admin/users/1" do
assert_generates("/admin/users/1", :controller =>
''customer/users/1'',
:action => ''edit'')
end
--
View this message in context:
http://www.nabble.com/stricter-routing-specs-with-conditional-routes-tp22691023p24431748.html
Sent from the rspec-users mailing list archive at Nabble.com.
jendavis
2009-Jul-10 17:42 UTC
[rspec-users] stricter routing specs with conditional routes
Thank you! This solved my problem. Maksim Horbul wrote:> > Here is the solution for that issue: > > it "should map {:action => ''edit''} to /admin/users/1" do > assert_generates("/admin/users/1", :controller => ''customer/users/1'', > :action => ''edit'') > end >-- View this message in context: http://www.nabble.com/stricter-routing-specs-with-conditional-routes-tp22691023p24431870.html Sent from the rspec-users mailing list archive at Nabble.com.