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"}
任何人有一個想法,我怎麼能作出這樣的測試通過?
我發現'索引'測試工作,如果'路由'測試被刪除。我看不出爲什麼這是我自己的問題!我會更新帖子,如果我找到原因... –