class DynportTools::HaveAttributesMatcher::HaveAttributes
Public Class Methods
new(expected)
click to toggle source
# File lib/dynport_tools/have_attributes.rb, line 3 def initialize(expected) @expected = expected end
Public Instance Methods
differ()
click to toggle source
# File lib/dynport_tools/have_attributes.rb, line 7 def differ @differ ||= DynportTools::Differ.new(:diff_all => false) end
failure_message()
click to toggle source
# File lib/dynport_tools/have_attributes.rb, line 26 def failure_message @error end
matches?(target)
click to toggle source
# File lib/dynport_tools/have_attributes.rb, line 11 def matches?(target) @target = if target.respond_to?(:attributes) differ.symbolize_keys = true target.attributes else target end if diff = differ.diff(@expected, @target) @error = differ.diff_to_message_lines(diff).join("\n") false else true end end