class Shoulda::Matchers::ActiveRecord::AssociationMatchers::SourceMatcher
@private
Attributes
Public Class Methods
Source
# File lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb, line 9 def initialize(source, name) @source = source @name = name @missing_option = '' end
Public Instance Methods
Source
# File lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb, line 15 def description "source => #{source}" end
Source
# File lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb, line 19 def matches?(subject) self.subject = ModelReflector.new(subject, name) if option_verifier.correct_for_string?(:source, source) true else self.missing_option = "#{name} should have #{source} as source option" false end end
Protected Instance Methods
Source
# File lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb, line 35 def option_verifier @_option_verifier ||= OptionVerifier.new(subject) end