Class: Mimic::FakeHost::StubbedRequest
- Inherits:
-
Object
- Object
- Mimic::FakeHost::StubbedRequest
- Defined in:
- lib/mimic/fake_host.rb
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(app, method, path) ⇒ StubbedRequest
constructor
A new instance of StubbedRequest.
- #returning(body, code = 200, headers = {}) ⇒ Object
Constructor Details
#initialize(app, method, path) ⇒ StubbedRequest
Returns a new instance of StubbedRequest.
83 84 85 86 87 88 89 |
# File 'lib/mimic/fake_host.rb', line 83 def initialize(app, method, path) @method, @path = method, path @code = 200 @headers = {} @body = "" @app = app end |
Instance Method Details
#build ⇒ Object
99 100 101 102 |
# File 'lib/mimic/fake_host.rb', line 99 def build response = [@code, @headers, @body] @app.send(@method.downcase, @path) { response } end |
#returning(body, code = 200, headers = {}) ⇒ Object
91 92 93 94 95 96 97 |
# File 'lib/mimic/fake_host.rb', line 91 def returning(body, code = 200, headers = {}) tap do @body = body @code = code @headers = headers end end |