Class: Amfetamine::FakeResponse
- Inherits:
-
Object
- Object
- Amfetamine::FakeResponse
- Defined in:
- lib/amfetamine/helpers/test_helpers.rb
Instance Method Summary collapse
- #body ⇒ Object
- #code ⇒ Object
-
#initialize(method, code2, block) ⇒ FakeResponse
constructor
A new instance of FakeResponse.
- #parsed_response ⇒ Object
Constructor Details
#initialize(method, code2, block) ⇒ FakeResponse
Returns a new instance of FakeResponse.
89 90 91 92 93 |
# File 'lib/amfetamine/helpers/test_helpers.rb', line 89 def initialize(method, code2, block) @method = method @response_code = code2 || 200 @inner_body = block.call || {} end |
Instance Method Details
#body ⇒ Object
99 100 101 |
# File 'lib/amfetamine/helpers/test_helpers.rb', line 99 def body MultiJson.encode(@inner_body) if @inner_body end |
#code ⇒ Object
95 96 97 |
# File 'lib/amfetamine/helpers/test_helpers.rb', line 95 def code @response_code end |
#parsed_response ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/amfetamine/helpers/test_helpers.rb', line 103 def parsed_response if body MultiJson.decode(body) else {} end end |