Class: Rtml::Test::Spec::Matchers::ResemblanceMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rtml/test/spec/matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected_hash) ⇒ ResemblanceMatcher

Returns a new instance of ResemblanceMatcher.



3
4
5
# File 'lib/rtml/test/spec/matchers.rb', line 3

def initialize(expected_hash)
  @expected_hash = expected_hash
end

Instance Method Details

#failure_messageObject



12
13
14
# File 'lib/rtml/test/spec/matchers.rb', line 12

def failure_message
  "Expected to resemble #{@expected_hash.inspect}; found:\n#{@test.tml}"
end

#matches?(target) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/rtml/test/spec/matchers.rb', line 7

def matches?(target)
  @test = Rtml::Test::ResemblanceTest.new(@expected_hash, target)
  @test.pass?
end

#negative_failure_messageObject



16
17
18
# File 'lib/rtml/test/spec/matchers.rb', line 16

def negative_failure_message
  "Expected to not resemble #{@expected_hash.inspect}; found:\n#{@test.tml}"
end