Class: RSpec::Raml::Matchers::MatchRamlBody

Inherits:
Abstract
  • Object
show all
Defined in:
lib/rspec/raml/matchers/match_raml_body.rb

Instance Attribute Summary

Attributes inherited from Abstract

#raml, #response, #status, #url, #verb

Instance Method Summary collapse

Methods inherited from Abstract

#matches?

Constructor Details

#initializeMatchRamlBody

Returns a new instance of MatchRamlBody.



8
9
10
11
12
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 8

def initialize(*)
  super
  @excludes = []
  @differ   = RSpec::Support::Differ.new(color: true)
end

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 14

def description
  'match RAML body'
end

#exclude(*values) ⇒ Object Also known as: except



18
19
20
21
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 18

def exclude(*values)
  @excludes += values
  self
end

#failure_messageObject



24
25
26
27
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 24

def failure_message
  diff = @differ.diff_as_object(actual, expected)
  "expected response bodies to match:#{diff}"
end

#failure_message_when_negatedObject



29
30
31
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 29

def failure_message_when_negated
  "expected response bodies not to match"
end