I get this error when running my rspec expects with custom validators.

expect {@ua.save!}.to  raise_error(ActiveRecord::RecordInvalid,'Validation failed: This question is no longer active')

fails with

expected ActiveRecord::RecordInvalid with "Validation failed: This question is no longer active", got #<ActiveRecord::RecordInvalid: Validation failed: This question is no longer active.> with backtrace:

This only seems to be problem with my custom validations. See this model:

class UserAnswer < ActiveRecord::Base
  belongs_to :user
  belongs_to :question
  validate :questionIsActive?

  private

  def questionIsActive?
    errors.add(:base, "This question is no longer active.") if !self.question.is_active?
  end
end

Using: Rails 3.2.11 Rspec-rails 2.12.2

Edit
Report