こんにちは私は、私のアプリの機能部品をテストしているときに、基本的にテストが実行されますが、私はそれが何を参照しているか分からないこれらのエラーを取得します。テストレールが機能するときのエラー
AdminControllerTest:
ERROR should get index (0.13s)
NoMethodError: undefined method `users' for #<AdminControllerTest:0x007fe9e0119000> /Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack- 3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
CartsControllerTest:
ERROR should create cart (0.12s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9de592b10>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack
3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should destroy cart (0.17s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9de3569a0>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack- 3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should get edit (0.12s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9e10c19d0>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should get index (0.11s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9e10604f0>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should get new (0.11s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9e1033fe0>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should show cart (0.11s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9e10109c8>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
ERROR should update cart (0.12s)
NoMethodError: undefined method `carts' for #<CartsControllerTest:0x007fe9de460558>
/Users/@@@@@/Dropbox/blind/rack/ruby/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/testing/assertions/routing.rb:175:in `method_missing'
カートコントローラテスト は、これを実現させることができた何test_helper "
class CartsControllerTest < ActionController::TestCase
setup do
@cart = carts(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:carts)
end
test "should get new" do
get :new
assert_response :success
end
test "should create cart" do
assert_difference('Cart.count') do
post :create, cart: @cart.attributes
end
assert_redirected_to cart_path(assigns(:cart))
end
test "should show cart" do
get :show, id: @cart
assert_response :success
end
test "should get edit" do
get :edit, id: @cart
assert_response :success
end
が必要ですか?
あなたの管理者やカートコントローラーのテストを投稿します。 – James