【发布时间】:2012-11-28 08:47:15
【问题描述】:
给定路线:
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"}
有人知道我怎样才能通过测试吗?
【问题讨论】:
-
我发现如果删除了“路由”测试,“索引”测试就会起作用。我不明白为什么我自己会成为一个问题!如果我找出原因,我会更新帖子......
标签: ruby-on-rails routes functional-testing