spec/faraday/response_spec.rb in faraday-2.7.2 vs spec/faraday/response_spec.rb in faraday-2.7.3
- old
+ new
@@ -2,11 +2,11 @@
RSpec.describe Faraday::Response do
subject { Faraday::Response.new(env) }
let(:env) do
- Faraday::Env.from(status: 404, body: 'yikes',
+ Faraday::Env.from(status: 404, body: 'yikes', url: Faraday::Utils.URI('https://lostisland.github.io/faraday'),
response_headers: { 'Content-Type' => 'text/plain' })
end
it { expect(subject.finished?).to be_truthy }
it { expect { subject.finish({}) }.to raise_error(RuntimeError) }
@@ -28,10 +28,11 @@
it { expect(hash).to be_a(Hash) }
it { expect(hash[:status]).to eq(subject.status) }
it { expect(hash[:response_headers]).to eq(subject.headers) }
it { expect(hash[:body]).to eq(subject.body) }
+ it { expect(hash[:url]).to eq(subject.env.url) }
end
describe 'marshal serialization support' do
subject { Faraday::Response.new }
let(:loaded) { Marshal.load(Marshal.dump(subject)) }
@@ -43,9 +44,10 @@
it { expect(loaded.env[:params]).to be_nil }
it { expect(loaded.env[:body]).to eq(env[:body]) }
it { expect(loaded.env[:response_headers]).to eq(env[:response_headers]) }
it { expect(loaded.env[:status]).to eq(env[:status]) }
+ it { expect(loaded.env[:url]).to eq(env[:url]) }
end
describe '#on_complete' do
subject { Faraday::Response.new }