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.



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

def initialize(*)
  super
  @except = []
end

Instance Method Details

#descriptionObject



12
13
14
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 12

def description
  'match RAML body'
end

#except(*keys) ⇒ Object



16
17
18
19
# File 'lib/rspec/raml/matchers/match_raml_body.rb', line 16

def except(*keys)
  @except |= keys.map(&:to_s)
  self
end

#failure_messageObject



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

def failure_message
  diff = differ.diff_as_object(
    response_body,
    raml_body
  )

  "expected response bodies to match:#{diff}"
end

#failure_message_when_negatedObject



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

def failure_message_when_negated
  "expected response bodies not to match"
end