Skip to content

Commit

Permalink
Merge pull request #98 from jjb/integration-tests
Browse files Browse the repository at this point in the history
Integration tests
  • Loading branch information
mislav committed Oct 10, 2014
2 parents bee560a + 66273b1 commit 97dea23
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ gem 'multi_xml', '>= 0.5.3'
gem 'rack-cache', '>= 1.1'
gem 'rake', '>= 0.9'
gem 'rash', '>= 0.3'
gem 'simple_oauth', '>= 0.1'
gem 'simple_oauth', '>= 0.1', '< 0.3'

group :test do
gem 'cane', '>= 2.2.2', :platforms => [:mri_19, :mri_20, :mri_21]
gem 'rspec', '>= 3'
gem 'simplecov'
gem 'webmock'
end

gemspec
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ task :quality do
sh 'cane',
'--abc-max=15',
'--style-measure=110',
'--gte=coverage/covered_percent,98.9',
'--gte=coverage/covered_percent,98.5',
'--max-violations=0'
end
1 change: 1 addition & 0 deletions spec/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def format(result)
end

require 'rspec'
require 'webmock/rspec'
require 'faraday'

module EnvCompatibility
Expand Down
22 changes: 22 additions & 0 deletions spec/integration/follow_redirects_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'helper'
require 'faraday_middleware/response/follow_redirects'

describe FaradayMiddleware::FollowRedirects do
it "redirects" do
stub_request(:get, "http://facebook.com").to_return(
:status => 302,
:headers => { "Location" => "http://www.facebook.com/" })
stub_request(:get, "http://www.facebook.com/").to_return(
:status => 302,
:headers => { "Location" => "https://www.facebook.com/" })
stub_request(:get, "https://www.facebook.com/")

connection = Faraday.new do |conn|
conn.use FaradayMiddleware::FollowRedirects
conn.adapter Faraday.default_adapter
end

response = connection.get "http://facebook.com"
expect(response.env[:url].to_s).to eq("https://www.facebook.com/")
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 97dea23

Please sign in to comment.