Class: Rtml::Test::Spec::Matchers::ResemblanceMatcher
- Inherits:
-
Object
- Object
- Rtml::Test::Spec::Matchers::ResemblanceMatcher
- Defined in:
- lib/rtml/test/spec/matchers.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(expected_hash) ⇒ ResemblanceMatcher
constructor
A new instance of ResemblanceMatcher.
- #matches?(target) ⇒ Boolean
- #negative_failure_message ⇒ Object
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_message ⇒ Object
12 13 14 |
# File 'lib/rtml/test/spec/matchers.rb', line 12 def "Expected to resemble #{@expected_hash.inspect}; found:\n#{@test.tml}" end |
#matches?(target) ⇒ 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_message ⇒ Object
16 17 18 |
# File 'lib/rtml/test/spec/matchers.rb', line 16 def "Expected to not resemble #{@expected_hash.inspect}; found:\n#{@test.tml}" end |