Class: StubRequests::WebMock::Builder
- Defined in:
- lib/stub_requests/webmock/builder.rb
Overview
Module Builder is responsible for building WebMock::RequestStub's
Instance Attribute Summary collapse
- #callback ⇒ Object readonly
- #webmock_stub ⇒ Object readonly
Class Method Summary collapse
-
.build(verb, uri) { ... } ⇒ WebMock::RequestStub
Builds and registers a WebMock::RequestStub.
Instance Method Summary collapse
-
#build ⇒ WebMock::RequestStub
Prepares a WebMock::RequestStub and registers it in WebMock.
-
#initialize(verb, uri) { ... } ⇒ Builder
constructor
Initializes a new instance of.
Constructor Details
#initialize(verb, uri) { ... } ⇒ Builder
Initializes a new instance of
57 58 59 60 |
# File 'lib/stub_requests/webmock/builder.rb', line 57 def initialize(verb, uri, &callback) @webmock_stub = ::WebMock::RequestStub.new(verb, uri) @callback = callback end |
Instance Attribute Details
#callback ⇒ Object (readonly)
46 47 48 |
# File 'lib/stub_requests/webmock/builder.rb', line 46 def callback @callback end |
#webmock_stub ⇒ Object (readonly)
42 43 44 |
# File 'lib/stub_requests/webmock/builder.rb', line 42 def webmock_stub @webmock_stub end |
Class Method Details
.build(verb, uri) { ... } ⇒ WebMock::RequestStub
Builds and registers a WebMock::RequestStub
35 36 37 |
# File 'lib/stub_requests/webmock/builder.rb', line 35 def self.build(verb, uri, &callback) new(verb, uri, &callback).build end |
Instance Method Details
#build ⇒ WebMock::RequestStub
Prepares a WebMock::RequestStub and registers it in WebMock
68 69 70 71 |
# File 'lib/stub_requests/webmock/builder.rb', line 68 def build Docile.dsl_eval(webmock_stub, &callback) if callback.present? webmock_stub end |