mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
571a6dc958
- Add a new test helper, response_from_res_double, which is a handy way to create a RestClient::Response given doubles for the Net::HTTPResponse and RestClient::Request. - Rename response_double to res_double to better reflect that it is a stand-in for Net::HTTPResponse.
22 lines
660 B
Ruby
22 lines
660 B
Ruby
require_relative '_lib'
|
|
|
|
describe RestClient::RawResponse do
|
|
before do
|
|
@tf = double("Tempfile", :read => "the answer is 42", :open => true, :rewind => true)
|
|
@net_http_res = double('net http response')
|
|
@request = double('restclient request', :redirection_history => nil)
|
|
@response = RestClient::RawResponse.new(@tf, @net_http_res, @request)
|
|
end
|
|
|
|
it "behaves like string" do
|
|
expect(@response.to_s).to eq 'the answer is 42'
|
|
end
|
|
|
|
it "exposes a Tempfile" do
|
|
expect(@response.file).to eq @tf
|
|
end
|
|
|
|
it "includes AbstractResponse" do
|
|
expect(RestClient::RawResponse.ancestors).to include(RestClient::AbstractResponse)
|
|
end
|
|
end
|