Parent

Class/Module Index [+]

Quicksearch

Shoulda::Matchers::ActiveRecord::AssociationMatchers::InverseOfMatcher

@private

Attributes

inverse_of[RW]
missing_option[RW]
name[RW]
subject[RW]

Public Class Methods

new(inverse_of, name) click to toggle source
# File lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb, line 9
def initialize(inverse_of, name)
  @inverse_of = inverse_of
  @name = name
  @missing_option = ''
end

Public Instance Methods

description() click to toggle source
# File lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb, line 15
def description
  "inverse_of => #{inverse_of}"
end
matches?(subject) click to toggle source
# File lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb, line 19
def matches?(subject)
  self.subject = ModelReflector.new(subject, name)

  if option_verifier.correct_for_string?(:inverse_of, inverse_of)
    true
  else
    self.missing_option = "#{name} should have #{description}"
    false
  end
end

Protected Instance Methods

option_verifier() click to toggle source
# File lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb, line 34
def option_verifier
  @option_verifier ||= OptionVerifier.new(subject)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.