Parent

Class/Module Index [+]

Quicksearch

Shoulda::Matchers::ActiveModel::EnsureExclusionOfMatcher

@private

Public Class Methods

new(attribute) click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 94
def initialize(attribute)
  super(attribute)
  @array = nil
  @range = nil
  @expected_message = nil
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 118
def description
  "ensure exclusion of #{@attribute} in #{inspect_message}"
end
in_array(array) click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 101
def in_array(array)
  @array = array
  self
end
in_range(range) click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 106
def in_range(range)
  @range = range
  @minimum = range.first
  @maximum = range.max
  self
end
matches?(subject) click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 122
def matches?(subject)
  super(subject)

  if @range
    allows_lower_value &&
      disallows_minimum_value &&
      allows_higher_value &&
      disallows_maximum_value
  elsif @array
    disallows_all_values_in_array?
  end
end
with_message(message) click to toggle source
# File lib/shoulda/matchers/active_model/ensure_exclusion_of_matcher.rb, line 113
def with_message(message)
  @expected_message = message if message
  self
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.