3
所以我有一個看起來像這樣的路線:RoutingError與作用域路線RSpec的控制器檢測
scope "4" do
scope "public" do
scope ":apikey" do
resources :shops
end
end
end
和一堆控制器的硬件規格,其中的一個例子是這樣的:
describe ShopsController do
describe "when responding to a GET" do
context "#new" do
it "should create a new instance of the shop class" do
get :new
@shop.should_not_be_nil
end
end
end
end
在耙路,以及通過網絡瀏覽器,這個控制器/動作工作正常。但是,RSpec拋出:
1) ShopsController when responding to a GET#new should create a new instance of the shop class
Failure/Error: get :new
ActionController::RoutingError:
No route matches {:controller=>"shops", :action=>"new"}
# ./spec/controllers/shops_controller_spec.rb:9:in `block (4 levels) in <top (required)>'
當我從路由中刪除scope
語句,測試工作正常。有沒有辦法「通知」RSpec的路線範圍?
在此先感謝!
像冠軍一樣工作。謝謝! – ianm