class SimpleParams::ValidationMatchers::FormatMatcher

Attributes

attribute[RW]
default_value[RW]

Public Class Methods

new(attribute) click to toggle source
Calls superclass method
# File lib/simple_params/validation_matchers/format_matcher.rb, line 10
def initialize(attribute)
  super(attribute)
  @unformatted_value = nil
end

Public Instance Methods

description() click to toggle source
# File lib/simple_params/validation_matchers/format_matcher.rb, line 31
def description
  "Expect #{@attribute} with_value #{@unformatted_value} to format into #{@expected_value}"
end
failure_message_for_should() click to toggle source
# File lib/simple_params/validation_matchers/format_matcher.rb, line 35
def failure_message_for_should
  "Expect #{@attribute} with_value #{@unformatted_value} to format into #{@expected_value}"
end
failure_message_for_should_not() click to toggle source
# File lib/simple_params/validation_matchers/format_matcher.rb, line 39
def failure_message_for_should_not
  "Expected #{@attribute} with_value #{@unformatted_value} to not format into #{@expected_value}"
end
into(value) click to toggle source
# File lib/simple_params/validation_matchers/format_matcher.rb, line 20
def into(value)
  @expected_value = value
  self
end
matches?(subject) click to toggle source
Calls superclass method
# File lib/simple_params/validation_matchers/format_matcher.rb, line 25
def matches?(subject)
  super(subject)
  @subject.send("#{@attribute}=", @unformatted_value)
  @subject.send(attribute) == @expected_value
end
with_value(value) click to toggle source
# File lib/simple_params/validation_matchers/format_matcher.rb, line 15
def with_value(value)
  @unformatted_value = value
  self
end