spec/session_spec.rb in patron-0.11.1 vs spec/session_spec.rb in patron-0.12.0
- old
+ new
@@ -164,10 +164,15 @@
body = YAML::load(response.body)
expect(body.header["user-agent"]).to be == ["PatronTest"]
expect(body.header["x-test"]).to be == ["Testing"]
end
+ it "accepts the DNS cache timeout option" do
+ @session.dns_cache_timeout = 60
+ @session.get("/")
+ end
+
it "should raise an exception on timeout" do
@session.timeout = 1
expect {@session.get("/timeout")}.to raise_error(Patron::TimeoutError)
end
@@ -331,11 +336,11 @@
it "should upload data with :patch" do
data = "upload data"
response = @session.patch("/testpatch", data)
body = YAML::load(response.body)
- expect(body["body"]).to eq("upload data")
+ expect(body.body).to eq("upload data")
end
it "should upload data with :delete" do
data = "upload data"
response = @session.request(:delete, "/test", {}, :data => data)
@@ -549,10 +554,11 @@
describe 'when instantiating with hash arguments' do
let(:args) { {
:timeout => 10,
+ :dns_cache_timeout => 10,
:base_url => 'http://localhost:9001',
:headers => {'User-Agent' => 'myapp/1.0'}
} }
let(:session) { Patron::Session.new(args) }
@@ -561,9 +567,13 @@
expect(session.base_url).to be == args[:base_url]
end
it 'sets timeout' do
expect(session.timeout).to be == args[:timeout]
+ end
+
+ it 'sets DNS cache timeout' do
+ expect(session.dns_cache_timeout).to be == args[:dns_cache_timeout]
end
it 'sets headers' do
expect(session.headers).to be == args[:headers]
end