0
という名前のカスタムのために一致していない私は、ネストされたリソースのためのテストケースを記述しようとしていますし、私は次のエラーを見ています:RailsのActionControllerは:: TestCaseのNOルートは、ネストされたリソース
:Error:
test_should_get_single_budget_link(BudgetlinkControllerTest):
ActionController::RoutingError: No route matches {:budget_id=>980190962, :action=>"show", :controller=>"budgetlink"}
test/functional/budgetlink_controller_test.rb:5:in `test_should_get_single_budget_link'
私のroutes.rbをのように見えます私は私がCを持っているという事実であると考えてい
test "should get single budget link" do
get :show, 'budget_id' => budgets(:one).id
assert_response :success
assert_equal assigns(:budgetlink).primary, "Budget1"
assert_equal assigns(:budgetlink).secondary, "Budget2"
end
:
Simplebudget::Application.routes.draw do
root :to => "home#index"
resources :budgets do
resources :transactions
resources :budgets, :controller => :budgetlink
end
resources :classifications
resources :periodicities
end
私のテストでは、次のようになります。予算リンクの代わりにリソース名 "予算"を使用するルートを設定しました.Railsは現在のテストでは予算ルートを認識することができません。再マップされたルートを認識するようにテストを設定するにはどうすればよいですか?
必要であれば分かりませんが、傷つけることはできません。コントローラのコードは次のとおりです。
class BudgetlinkController < ApplicationController
skip_before_filter :verify_authenticity_token
def show
@budgetlink = Budgetlink.find(params[:primary], params[:secondary])
respond_to do |format|
format.html #index.html.erb
format.json { render :json => @budgetlink}
end
end
end