Class: Test::Spec::Rails::DummyResponse
- Defined in:
- lib/test/spec/rails/dummy_response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #html_document ⇒ Object
-
#initialize(body, headers = nil) ⇒ DummyResponse
constructor
A new instance of DummyResponse.
Methods inherited from TestDummy
#inspect, #method_missing, #real_controller, #real_request, #real_response
Constructor Details
#initialize(body, headers = nil) ⇒ DummyResponse
Returns a new instance of DummyResponse.
6 7 8 9 10 11 12 13 14 |
# File 'lib/test/spec/rails/dummy_response.rb', line 6 def initialize(body, headers=nil) if headers.nil? response = body.instance_variable_get('@response') @body, @headers = response.body, response.headers else @body, @headers = body, headers end @response = self end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Test::Spec::Rails::TestDummy
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/test/spec/rails/dummy_response.rb', line 4 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/test/spec/rails/dummy_response.rb', line 4 def content_type @content_type end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/test/spec/rails/dummy_response.rb', line 4 def headers @headers end |
Instance Method Details
#html_document ⇒ Object
16 17 18 |
# File 'lib/test/spec/rails/dummy_response.rb', line 16 def html_document @html_document ||= HTML::Document.new(@body) end |