안녕하세요, 내 응용 프로그램의 기능 부품을 테스트 할 때 기본적으로 테스트가 실행되지만 다음과 같은 오류가 발생하지만 참조하는 내용을 모르는 이러한 오류가 발생합니다.테스트 레일 기능을 할 때 오류가 발생했습니다
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