Sha256: 6c9c1580ff8a700c41e1a84a5175ab096c8ef4a11465cfc7f22ee1cc6c94921b
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
module APIMatchers module ResponseBody class Base attr_reader :setup, :expected_node, :actual attr_writer :actual def initialize(options={}) @expected_node = options.fetch(:expected_node) @setup = options.fetch(:setup) end def matches?(actual) raise NotImplementedError, "not implemented on #{self}" end def with(expected_value) @with_value = expected_value self end def response_body if @setup.response_body_method.present? @actual.send(@setup.response_body_method) else @actual end end def failure_message_for_should "expected to have node called: '#{@expected_node}'" << added_message << ". Got: '#{response_body}'" end def failure_message_for_should_not "expected to NOT have node called: '#{@expected_node}'" << added_message << ". Got: '#{response_body}'" end def added_message if @with_value " with value: '#{@with_value}'" else "" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
api_matchers-0.0.2 | lib/api_matchers/response_body/base.rb |
api_matchers-0.0.1 | lib/api_matchers/response_body/base.rb |