2015-03-13 21:00:51 -04:00
|
|
|
require_relative '_lib'
|
2009-03-16 18:28:20 -04:00
|
|
|
|
|
|
|
describe RestClient::RawResponse do
|
2009-12-29 12:27:39 -05:00
|
|
|
before do
|
2017-05-03 10:31:19 -04:00
|
|
|
@tf = double("Tempfile", :read => "the answer is 42", :open => true, :rewind => true)
|
2013-07-26 23:09:42 -04:00
|
|
|
@net_http_res = double('net http response')
|
2017-05-03 10:31:19 -04:00
|
|
|
@request = double('restclient request', :redirection_history => nil)
|
2016-05-01 16:57:54 -04:00
|
|
|
@response = RestClient::RawResponse.new(@tf, @net_http_res, @request)
|
2009-12-29 12:27:39 -05:00
|
|
|
end
|
2009-03-16 18:28:20 -04:00
|
|
|
|
2009-12-29 12:27:39 -05:00
|
|
|
it "behaves like string" do
|
2016-06-05 19:52:16 -04:00
|
|
|
expect(@response.to_s).to eq 'the answer is 42'
|
2009-12-29 12:27:39 -05:00
|
|
|
end
|
2009-03-16 18:28:20 -04:00
|
|
|
|
2009-12-29 12:27:39 -05:00
|
|
|
it "exposes a Tempfile" do
|
2016-06-05 19:52:16 -04:00
|
|
|
expect(@response.file).to eq @tf
|
2009-12-29 12:27:39 -05:00
|
|
|
end
|
2017-05-03 10:31:19 -04:00
|
|
|
|
|
|
|
it "includes AbstractResponse" do
|
|
|
|
expect(RestClient::RawResponse.ancestors).to include(RestClient::AbstractResponse)
|
|
|
|
end
|
2009-03-16 18:28:20 -04:00
|
|
|
end
|