Class: WebTrap::RSpec::Matchers::SendRequest Private

Inherits:
Object
  • Object
show all
Defined in:
lib/webtrap/rspec/matchers/send_request.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Provides the implementation for ‘send_request`. Not intended to be instantiated directly.

Direct Known Subclasses

SendRequestWithXml

Instance Method Summary collapse

Instance Method Details

#failure_messageString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Message to be shown if the expectation fails to pass.

Returns:

  • (String)


43
44
45
# File 'lib/webtrap/rspec/matchers/send_request.rb', line 43

def failure_message
  "expected block to send an HTTP request, but nothing was sent out"
end

#matches?(transmission_proc) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Checks if the provided Proc sends an HTTP request.

Parameters:

  • transmission_proc (Proc)

    The proc that should send an HTTP request.

Returns:

  • (Boolean)

    Whether an HTTP request was sent.

See Also:

  • WebTrap::RSpec::Matchers::SendRequest.{RSpec{RSpec::Matchers{RSpec::Matchers::MatcherProtocol{RSpec::Matchers::MatcherProtocol#matches?}


35
36
37
38
# File 'lib/webtrap/rspec/matchers/send_request.rb', line 35

def matches?(transmission_proc)
  perform_transmission(transmission_proc)
  request_sent?
end

#supports_block_expectations?TrueClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Allows the matcher to be used with block expectations.

Returns:

  • (TrueClass)


50
51
52
# File 'lib/webtrap/rspec/matchers/send_request.rb', line 50

def supports_block_expectations?
  true
end

#with_xml(xml) ⇒ SendRequestWithXml

Specifies the XML payload of the request.

The expectation will pass only if a request is sent with a payload that is considered equivalent to the reference. For further details see the equivalent-xml gem.

Parameters:

  • xml

    The reference XML payload.

Returns:

  • (SendRequestWithXml)

    The matcher to verify that a request is with a payload equivalent to the reference.



24
25
26
# File 'lib/webtrap/rspec/matchers/send_request.rb', line 24

def with_xml(xml)
  SendRequestWithXml.new(xml)
end