Class: RightDevelop::Testing::Client::Rest::Request::Playback::FakeNetHttpResponse
- Inherits:
-
Object
- Object
- RightDevelop::Testing::Client::Rest::Request::Playback::FakeNetHttpResponse
- Defined in:
- lib/right_develop/testing/clients/rest/requests/playback.rb
Overview
fake Net::HTTPResponse
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#call_count ⇒ Object
readonly
Returns the value of attribute call_count.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#delay_seconds ⇒ Object
readonly
Returns the value of attribute delay_seconds.
-
#elapsed_seconds ⇒ Object
readonly
Returns the value of attribute elapsed_seconds.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(response_hash, response_metadata) ⇒ FakeNetHttpResponse
constructor
A new instance of FakeNetHttpResponse.
- #to_hash ⇒ Object
Constructor Details
#initialize(response_hash, response_metadata) ⇒ FakeNetHttpResponse
Returns a new instance of FakeNetHttpResponse.
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 45 def initialize(response_hash, ) @delay_seconds = .delay_seconds @elapsed_seconds = Integer(response_hash[:elapsed_seconds] || 0) @code = .http_status.to_s @headers = .headers.inject({}) do |h, (k, v)| h[k] = Array(v) # expected to be an array h end @body = .body # optional @call_count = Integer(response_hash[:call_count]) || 1 end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
43 44 45 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 43 def body @body end |
#call_count ⇒ Object (readonly)
Returns the value of attribute call_count.
43 44 45 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 43 def call_count @call_count end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
43 44 45 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 43 def code @code end |
#delay_seconds ⇒ Object (readonly)
Returns the value of attribute delay_seconds.
43 44 45 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 43 def delay_seconds @delay_seconds end |
#elapsed_seconds ⇒ Object (readonly)
Returns the value of attribute elapsed_seconds.
43 44 45 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 43 def elapsed_seconds @elapsed_seconds end |
Instance Method Details
#[](key) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 57 def [](key) if header = @headers[key.downcase] header.join(', ') else nil end end |
#to_hash ⇒ Object
65 |
# File 'lib/right_develop/testing/clients/rest/requests/playback.rb', line 65 def to_hash; @headers; end |