class Shoulda::Matchers::ActiveModel::AllowValueMatcher::AttributeSetterAndValidator

@private

Attributes

allow_value_matcher[R]
attribute_name[R]
value[R]

Public Class Methods

new(allow_value_matcher, attribute_name, value) click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb, line 22
def initialize(allow_value_matcher, attribute_name, value)
  @allow_value_matcher = allow_value_matcher
  @attribute_name = attribute_name
  @value = value
  @_attribute_setter = nil
  @_validator = nil
end

Public Instance Methods

attribute_setter() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb, line 30
def attribute_setter
  @_attribute_setter ||= AttributeSetter.new(
    matcher_name: :allow_value,
    object: instance,
    attribute_name: attribute_name,
    value: value,
    ignore_interference_by_writer: ignore_interference_by_writer,
    after_set_callback: after_setting_value_callback,
  )
end
attribute_setter_description() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb, line 41
def attribute_setter_description
  attribute_setter.description
end
validator() click to toggle source
# File lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb, line 45
def validator
  @_validator ||= Validator.new(
    instance,
    attribute_to_check_message_against,
    context: context,
    expects_strict: expects_strict?,
    expected_message: expected_message,
  )
end