Class: WebTrap::Shared::Validators::RequestSentValidator Private

Inherits:
Object
  • Object
show all
Defined in:
lib/webtrap/shared/validators/request_sent_validator.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.

Validator for asserting whether a request was sent.

Instance Method Summary collapse

Constructor Details

#initializeRequestSentValidator

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.

Initialize a new validator.



7
8
9
# File 'lib/webtrap/shared/validators/request_sent_validator.rb', line 7

def initialize
  @failed = true
end

Instance Method Details

#failed?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.

Whether no request was validated.

Returns:

  • (Boolean)


14
15
16
# File 'lib/webtrap/shared/validators/request_sent_validator.rb', line 14

def failed?
  @failed
end

#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.

The message to be used if no request is validated.

Returns:

  • (String)


21
22
23
# File 'lib/webtrap/shared/validators/request_sent_validator.rb', line 21

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

#validate(_) ⇒ RequestSentValidator

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.

Validate a request.

Since validators are run against intercepted requests this validator will succeed for any request.

Returns:



32
33
34
35
# File 'lib/webtrap/shared/validators/request_sent_validator.rb', line 32

def validate(_)
  @failed = false
  self
end