class Shoulda::Matchers::ActiveModel::AllowValueMatcher::AttributeChangedValueError

@private

Attributes

attribute_name[RW]
matcher_name[RW]
model[RW]
value_read[RW]
value_written[RW]

Public Instance Methods

message() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb, line 10
          def message
            Shoulda::Matchers.word_wrap <<-MESSAGE
The #{matcher_name} matcher attempted to set :#{attribute_name} on
#{model.name} to #{value_written.inspect}, but when the attribute was
read back, it had stored #{value_read.inspect} instead.

This creates a problem because it means that the model is behaving in a
way that is interfering with the test -- there's a mismatch between the
test that you wrote and test that we actually ran.

There are a couple of reasons why this could be happening:

* ActiveRecord is typecasting the incoming value.
* The writer method for :#{attribute_name} has been overridden so that
  incoming values are changed in some way.

If this exception makes sense to you and you wish to bypass it, try
adding the `ignoring_interference_by_writer` qualifier onto the end of
your matcher. If the test still does not pass after that, then you may
need to do something different.

If you need help, feel free to ask a question on the shoulda-matchers
issues list:

http://github.com/thoughtbot/shoulda-matchers/issues
            MESSAGE
          end
successful?() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb, line 38
def successful?
  false
end