Class: StubRequests::RequestStub
Overview
Class Stub tracks the WebMock::RequestStub life cycle
Instance Attribute Summary collapse
-
#endpoint ⇒ Endpoint
readonly
Retrieve the endpoint for this request stub.
-
#recorded_at ⇒ Time
readonly
The time this record was recorded.
-
#recorded_from ⇒ String
readonly
The relative path to the spec that recorded it.
-
#responded_at ⇒ Time
readonly
The time this stubs response was used.
-
#uri ⇒ String
readonly
The full URI for this endpoint.
-
#verb ⇒ Symbol
readonly
A HTTP verb/method.
-
#webmock_stub ⇒ WebMock::RequestStub
readonly
A webmock stubbed request.
Instance Method Summary collapse
-
#initialize(endpoint_id, webmock_stub) ⇒ RequestStub
constructor
Initialize a new Record.
-
#mark_as_responded ⇒ Time
Marks this record as having responded.
Methods included from Concerns::Property
Methods included from Concerns::ArgumentValidation
Constructor Details
#initialize(endpoint_id, webmock_stub) ⇒ RequestStub
Initialize a new Record
63 64 65 66 67 68 69 70 71 72 |
# File 'lib/stub_requests/request_stub.rb', line 63 def initialize(endpoint_id, webmock_stub) request_pattern = webmock_stub.request_pattern self.endpoint_id = endpoint_id self.verb = request_pattern.method_pattern.to_s.to_sym self.request_uri = request_pattern.uri_pattern.to_s self.webmock_stub = webmock_stub self.recorded_at = Time.now self.recorded_from = RSpec.current_example.[:location] @responded_at = nil # ByPass the validation for the initializer end |
Instance Attribute Details
#endpoint ⇒ Endpoint (readonly)
Retrieve the endpoint for this request stub
30 |
# File 'lib/stub_requests/request_stub.rb', line 30 property :endpoint_id, type: Symbol |
#recorded_at ⇒ Time (readonly)
Returns the time this record was recorded
46 |
# File 'lib/stub_requests/request_stub.rb', line 46 property :recorded_at, type: Time |
#recorded_from ⇒ String (readonly)
Returns the relative path to the spec that recorded it
50 |
# File 'lib/stub_requests/request_stub.rb', line 50 property :recorded_from, type: String |
#responded_at ⇒ Time (readonly)
Returns the time this stubs response was used
54 |
# File 'lib/stub_requests/request_stub.rb', line 54 property :responded_at, type: Time |
#uri ⇒ String (readonly)
Returns the full URI for this endpoint
38 |
# File 'lib/stub_requests/request_stub.rb', line 38 property :request_uri, type: String |
#verb ⇒ Symbol (readonly)
Returns a HTTP verb/method
34 |
# File 'lib/stub_requests/request_stub.rb', line 34 property :verb, type: Symbol |
#webmock_stub ⇒ WebMock::RequestStub (readonly)
Returns a webmock stubbed request
42 |
# File 'lib/stub_requests/request_stub.rb', line 42 property :webmock_stub, type: WebMock::RequestStub |