Skip to content

Instantly share code, notes, and snippets.

@gamov
Created November 28, 2012 08:22
Show Gist options
  • Save gamov/4159841 to your computer and use it in GitHub Desktop.
Save gamov/4159841 to your computer and use it in GitHub Desktop.
Functional testing a controller with a scoped path?!?
#routes
scope :path => 'shipping_reports', :controller => 'ShippingReports', :as => 'shipping_reports' do
get 'index'
end
#test
class ShippingReportsControllerTest < ActionController::TestCase
test "routing" do
assert_routing '/shipping_reports/index', { :controller => "ShippingReports", :action => "index" }
end
test 'index' do
get :index, :controller => 'ShippingReports'
assert_response :success
end
end
# first passes, second fails with:
#ActionController::RoutingError: No route matches {:controller=>"shipping_reports"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment