2013-04-19 2 views
1

내 사용자 클래스를 테스트 할 Shoulda를 사용하는 것을 시도하고있다 :NoMethodError : 정의되지 않은 메서드`failure_message` - 다음과 같이 했어야

user_test.rb

require 'test_helper' 
include Devise::TestHelpers 

class UserTest < Test::Unit::TestCase 
    should have_many(:holidays) 
    should have_many(:hopsital_bookings) 
    should have_and_belong_to_many(:roles) 
    should belong_to(:hospital) 

end 

User.rb

belongs_to :hospital 
    belongs_to :department 
    has_many :holidays 
    has_many :hospital_bookings 
    has_and_belongs_to_many :roles 

rake test을 실행하면 다음 출력이 표시됩니다. Imgur.

내가 여기에 누락 된 이유는 무엇이며 왜 이것이 작동하지 않는 이유입니까?

+0

'test_helper.rb'에 무엇이 있습니까? –

답변

0

것 같습니다 당신은해야한다는 : 당신의 보석 파일에 넣어

1) :

그룹 : 테스트

2) 실행 번들 보석 '했어야' 끝을 설치하는

관련 문제