Class: Handsoap::Http::HttpMock
- Inherits:
-
Object
- Object
- Handsoap::Http::HttpMock
- Defined in:
- lib/handsoap/http.rb
Overview
A mock driver for your testing needs.
To use it, create a new instance and assign to Handsoap::Http.drivers. Then configure Handsoap::Service to use it:
Handsoap::Http.drivers[:mock] = Handsoap::Http::HttpMock.new :status => 200, :headers => headers, :content => body
Handsoap.http_driver = :mock
Remember that headers should use rn, rather than n.
Instance Attribute Summary collapse
-
#is_loaded ⇒ Object
Returns the value of attribute is_loaded.
-
#last_request ⇒ Object
Returns the value of attribute last_request.
-
#mock ⇒ Object
Returns the value of attribute mock.
Instance Method Summary collapse
-
#initialize(mock) ⇒ HttpMock
constructor
A new instance of HttpMock.
- #load! ⇒ Object
- #send_http_request(request) ⇒ Object
Constructor Details
#initialize(mock) ⇒ HttpMock
Returns a new instance of HttpMock.
250 251 252 253 |
# File 'lib/handsoap/http.rb', line 250 def initialize(mock) @mock = mock @is_loaded = false end |
Instance Attribute Details
#is_loaded ⇒ Object
Returns the value of attribute is_loaded.
249 250 251 |
# File 'lib/handsoap/http.rb', line 249 def is_loaded @is_loaded end |
#last_request ⇒ Object
Returns the value of attribute last_request.
249 250 251 |
# File 'lib/handsoap/http.rb', line 249 def last_request @last_request end |
#mock ⇒ Object
Returns the value of attribute mock.
249 250 251 |
# File 'lib/handsoap/http.rb', line 249 def mock @mock end |
Instance Method Details
#load! ⇒ Object
254 255 256 |
# File 'lib/handsoap/http.rb', line 254 def load! is_loaded = true end |
#send_http_request(request) ⇒ Object
257 258 259 260 |
# File 'lib/handsoap/http.rb', line 257 def send_http_request(request) @last_request = request Handsoap::Http.parse_http_part(mock[:headers], mock[:content], mock[:status], mock[:content_type]) end |