Class: MatchYAMLMatcher
- Defined in:
- lib/extensions/mspec/mspec/matchers/match_yaml.rb
Instance Method Summary collapse
- #failure_message ⇒ Object
-
#initialize(expected) ⇒ MatchYAMLMatcher
constructor
A new instance of MatchYAMLMatcher.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(expected) ⇒ MatchYAMLMatcher
Returns a new instance of MatchYAMLMatcher.
3 4 5 6 7 8 9 |
# File 'lib/extensions/mspec/mspec/matchers/match_yaml.rb', line 3 def initialize(expected) if valid_yaml?(expected) @expected = expected else @expected = expected.to_yaml end end |
Instance Method Details
#failure_message ⇒ Object
16 17 18 |
# File 'lib/extensions/mspec/mspec/matchers/match_yaml.rb', line 16 def ["Expected #{@actual.inspect}", " to match #{@expected.inspect}"] end |
#matches?(actual) ⇒ Boolean
11 12 13 14 |
# File 'lib/extensions/mspec/mspec/matchers/match_yaml.rb', line 11 def matches?(actual) @actual = actual clean_yaml(@actual) == @expected end |
#negative_failure_message ⇒ Object
20 21 22 |
# File 'lib/extensions/mspec/mspec/matchers/match_yaml.rb', line 20 def ["Expected #{@actual.inspect}", " to match #{@expected.inspect}"] end |