Class: Net::HTTPResponse
- Inherits:
-
Object
- Object
- Net::HTTPResponse
- Defined in:
- lib/evostream/event/response/mock.rb
Overview
Override Net::HTTPResponse for create response with body
Class Method Summary collapse
Class Method Details
.mock(body = {}.to_json) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/evostream/event/response/mock.rb', line 7 def self.mock(body = {}.to_json) # construct clazz = self response = clazz.new('1.1', '200', 'OK') # inject response.instance_variable_set :@body, body # mockulate response.instance_eval 'def body; @body.to_json; end' response end |