spec/faraday/response_spec.rb in capgun-0.1.0 vs spec/faraday/response_spec.rb in capgun-0.1.1
- old
+ new
@@ -17,11 +17,11 @@
}.each do |status, exception|
if (status >= 500)
context "when HTTP status is #{status}" do
before do
stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.0.3'}).
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.1'}).
to_return(:status => status, :body => "", :headers => {})
end
it "should raise #{exception.name} error" do
lambda do
@@ -33,11 +33,11 @@
[nil, "message", "error", "errors"].each do |body|
context "when HTTP status is #{status} and body is #{body||='nil'}" do
before do
body_message = '{"'+body+'":"test"}' unless body.nil?
stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.0.3'}).
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.1'}).
to_return(:status => status, :body => body_message, :headers => {})
end
it "should raise #{exception.name} error" do
lambda do
@@ -52,10 +52,10 @@
context "when response status is 404 from lookup" do
before do
stub_request(:get, "https://api.capgun.io/v1/jobs/abc123.json").
- with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.0.3'}).
+ with(:headers => {'Accept'=>'application/json', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'', 'User-Agent'=>'Capgun.io Ruby Gem 0.1.1'}).
to_return(:status => 404, :body => fixture('notfound.json'), :headers => {})
end
it "should raise Capgun::Error::NotFound" do
lambda do