Sha256: d9a72d582180bc295cfd52fbe62c681e2393142107a0d75fd6e91797e5b8fb9e
Contents?: true
Size: 967 Bytes
Versions: 7
Compression:
Stored size: 967 Bytes
Contents
module Shoulda # :nodoc: module Matchers module ActiveRecord # :nodoc: module AssociationMatchers class DependentMatcher attr_accessor :missing_option def initialize(dependent, name) @dependent = dependent @name = name @missing_option = '' end def description "dependent => #{dependent}" end def matches?(subject) self.subject = ModelReflector.new(subject, name) if option_verifier.correct_for_string?(:dependent, dependent) true else self.missing_option = "#{name} should have #{dependent} dependency" false end end private attr_accessor :subject, :dependent, :name def option_verifier @option_verifier ||= OptionVerifier.new(subject) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems