spec/session_spec.rb in patron-0.7.1 vs spec/session_spec.rb in patron-0.8.0
- old
+ new
@@ -26,10 +26,11 @@
require File.expand_path("./spec") + '/spec_helper.rb'
require 'webrick'
require 'yaml'
require 'base64'
require 'fileutils'
+require 'securerandom'
describe Patron::Session do
before(:each) do
@session = Patron::Session.new
@@ -231,19 +232,19 @@
it "should upload data with :get" do
# Sending a request body with a GET request is a technique seldom used,
# but it does get used nevertheless - for instance, it is a usual
# practice when interacting with an ElasticSearch cluster where
# you can have very deeply going queries, which are still technically GETs
- data = SecureRandom.random_bytes(1024 * 24)
+ data = Random.new.bytes(1024 * 24)
response = @session.request(:get, "/test", {}, :data => data)
body = YAML::load(response.body)
expect(body.request_method).to be == "GET"
expect(body.header['content-length']).to be == [data.size.to_s]
end
it "should upload data with :put" do
- data = SecureRandom.random_bytes(1024 * 24)
+ data = Random.new.bytes(1024 * 24)
response = @session.put("/test", data)
body = YAML::load(response.body)
expect(body.request_method).to be == "PUT"
expect(body.header['content-length']).to be == [data.size.to_s]
end
@@ -516,10 +517,10 @@
}
session = Patron::Session.new do |patron|
patron.timeout = args[:timeout]
patron.base_url = args[:base_url]
- patron.headers = args[:headers]
+ patron.headers = args[:headers]
end
it 'sets the base_url' do
expect(session.base_url).to be == args[:base_url]
end