Created
April 11, 2011 06:20
-
-
Save carpeliam/913132 to your computer and use it in GitHub Desktop.
this fails: No route matches "/foos/1/bars"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
module ActionDispatch::Routing | |
describe Mapper do | |
context "#my_method_that_modifies_routes", :type => :routing do | |
before do | |
# do some stuff that alters the routes | |
Rails.application.reload_routes! | |
@foo = Factory(:foo) | |
end | |
it "adds the route" do | |
Rails.application.routes.routes.map(&:name).should include 'foo_bars' # passes, so this should work | |
{:get => "/foos/#{@foo.id}/bars"}.should route_to(:controller => 'bars', :etc => 'etc') # fails: No route matches "/foos/1/bars" | |
end | |
after do | |
# undo what we've done and reload routes | |
Rails.application.reload_routes! | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment