views:

16

answers:

0

Hello I have a question about this error. I dont know why it happened to me, but in another pc it worked well. I've try this method

class BookTest < ActiveSupport::TestCase
  should_validate_presence_of(:author_id)
  should_have_many(:customer_reviews)
  should_belong_to(:author)
end

And I got an error lik this

  1) Error:
test: Book should require author_id to be set. (BookTest):
NameError: undefined local variable or method `validate_associated_records_for_customer_reviews' for #<ActiveSupport::Callbacks::Callback:0x4711b9c>
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/matchers/allow_value_matcher.rb:61:in `errors_match?'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/matchers/allow_value_matcher.rb:43:in `matches?'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/matchers/validation_matcher.rb:44:in `disallows_value_of'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb:32:in `matches?'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/assertions.rb:49:in `assert_accepts'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/active_record/macros.rb:41:in `__bind_1278348817_0'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `call'
    vendor/gems/thoughtbot-shoulda-2.10.2/lib/shoulda/context.rb:351:in `test: Book should require author_id to be set. '

Any suggestions for solve this problem? Thanks