Sha256: 23b78ba16173803e095c471f9553e00494e5b565d3d622487958216d69f077cd
Contents?: true
Size: 961 Bytes
Versions: 13
Compression:
Stored size: 961 Bytes
Contents
module Shoulda module Matchers module ActiveRecord module AssociationMatchers # @private class SourceMatcher attr_accessor :missing_option def initialize(source, name) @source = source @name = name @missing_option = '' end def description "source => #{source}" end 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 attr_accessor :subject, :source, :name def option_verifier @_option_verifier ||= OptionVerifier.new(subject) end end end end end end
Version data entries
13 entries across 13 versions & 1 rubygems