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)
-
- (Object) is_loaded
Returns the value of attribute is_loaded.
-
- (Object) last_request
Returns the value of attribute last_request.
-
- (Object) mock
Returns the value of attribute mock.
Instance Method Summary (collapse)
-
- (HttpMock) initialize(mock)
constructor
A new instance of HttpMock.
- - (Object) load!
- - (Object) send_http_request(request)
Constructor Details
- (HttpMock) initialize(mock)
A new instance of HttpMock
283 284 285 286 |
# File 'lib/handsoap/http.rb', line 283 def initialize(mock) @mock = mock @is_loaded = false end |
Instance Attribute Details
- (Object) is_loaded
Returns the value of attribute is_loaded
282 283 284 |
# File 'lib/handsoap/http.rb', line 282 def is_loaded @is_loaded end |
- (Object) last_request
Returns the value of attribute last_request
282 283 284 |
# File 'lib/handsoap/http.rb', line 282 def last_request @last_request end |
- (Object) mock
Returns the value of attribute mock
282 283 284 |
# File 'lib/handsoap/http.rb', line 282 def mock @mock end |
Instance Method Details
- (Object) load!
287 288 289 |
# File 'lib/handsoap/http.rb', line 287 def load! is_loaded = true end |
- (Object) send_http_request(request)
290 291 292 293 |
# File 'lib/handsoap/http.rb', line 290 def send_http_request(request) @last_request = request Handsoap::Http.parse_http_part(mock[:headers], mock[:content], mock[:status], mock[:content_type]) end |