class Shoulda::Matchers::ActiveRecord::AssociationMatchers::DependentMatcher
@private
def description
def description "dependent => #{dependent}" end
def generate_missing_option
def generate_missing_option [ "#{name} should have", (dependent == true ? 'a' : dependent), 'dependency' ].join(' ') end
def initialize(dependent, name)
def initialize(dependent, name) @dependent = dependent @name = name @missing_option = '' end
def matches?(subject)
def matches?(subject) self.subject = ModelReflector.new(subject, name) if option_matches? true else self.missing_option = generate_missing_option false end end
def option_matches?
def option_matches? option_verifier.correct_for?(option_type, :dependent, dependent) end
def option_type
def option_type case dependent when true, false then :boolean else :string end end
def option_verifier
def option_verifier @option_verifier ||= OptionVerifier.new(subject) end