给定路线:
scope :path => 'shipping_reports', :controller => 'ShippingReports', :as => 'shipping_reports' do
get 'index'
end
以及以下测试:
class ShippingReportsControllerTest < ActionController::TestCase
test "routing" do
assert_routing '/shipping_reports/index', { :controller => "ShippingReports", :action => "index" }
end
test 'index' do
get :index
assert_response :success
end
end
第一次测试通过,第二次失败:
ActionController::RoutingError: No route matches {:controller=>"shipping_reports"}
有人知道我怎样才能通过该测试吗?