Skip to content

Instantly share code, notes, and snippets.

@carpeliam
Created April 11, 2011 06:20
Show Gist options
  • Save carpeliam/913132 to your computer and use it in GitHub Desktop.
Save carpeliam/913132 to your computer and use it in GitHub Desktop.
this fails: No route matches "/foos/1/bars"
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