mirror of
https://github.com/lostisland/faraday.git
synced 2025-12-05 00:02:56 -05:00
Fix Ruby 1.9.3 tests on Travis. Drop support for Ruby 1.8.7. (#600)
* Drop support for Ruby 1.9.2, which no-one should be using any more. * Constraint gem versions for Ruby 1.9.3 * Drop support for Ruby 1.8.7. Many dependencies have dropped support for it. * Remove conditionals checking for Ruby 1.8.7 * Document Ruby version dependency
This commit is contained in:
parent
1647251ec7
commit
a712938071
@ -4,14 +4,11 @@ script: bundle exec script/test
|
||||
cache: bundler
|
||||
|
||||
rvm:
|
||||
- 1.8.7
|
||||
- 1.9.2
|
||||
- 1.9.3
|
||||
- 2.0.0
|
||||
- 2.1
|
||||
- 2.2
|
||||
- 2.3.1
|
||||
- jruby-18mode
|
||||
- jruby-19mode
|
||||
- jruby-20mode
|
||||
- jruby-21mode
|
||||
@ -22,7 +19,6 @@ matrix:
|
||||
allow_failures:
|
||||
# "A fatal error has been detected by the Java Runtime Environment:
|
||||
# Internal Error (sharedRuntime.cpp:843)"
|
||||
- rvm: jruby-18mode
|
||||
- rvm: jruby-19mode
|
||||
- rvm: jruby-20mode
|
||||
- rvm: jruby-21mode
|
||||
|
||||
13
Gemfile
13
Gemfile
@ -2,8 +2,7 @@ source 'https://rubygems.org'
|
||||
|
||||
gem 'ffi-ncurses', '~> 0.3', :platforms => :jruby
|
||||
gem 'jruby-openssl', '~> 0.8.8', :platforms => :jruby
|
||||
# Newer versions drop support for Ruby < 1.9.3, but we still support them.
|
||||
gem 'rake', '< 11.0.0'
|
||||
gem 'rake'
|
||||
|
||||
group :test do
|
||||
gem 'coveralls', :require => false
|
||||
@ -21,6 +20,16 @@ group :test do
|
||||
gem 'simplecov'
|
||||
gem 'sinatra', '~> 1.3'
|
||||
gem 'typhoeus', '~> 0.3.3', :platforms => [:ruby_18, :ruby_19, :ruby_20, :ruby_21]
|
||||
|
||||
# Below are dependencies of the gems we actually care about that have
|
||||
# dropped support for older Rubies. Because they are not first-level
|
||||
# dependencies, we don't need to specify an unconstrained version, so we can
|
||||
# lump them together here.
|
||||
|
||||
if RUBY_VERSION < '2'
|
||||
gem 'json', '< 2'
|
||||
gem 'tins', '< 1.7.0'
|
||||
end
|
||||
end
|
||||
|
||||
gemspec
|
||||
|
||||
@ -210,7 +210,7 @@ stubs.verify_stubbed_calls
|
||||
This library aims to support and is [tested against][travis] the following Ruby
|
||||
implementations:
|
||||
|
||||
* Ruby 1.8.7+
|
||||
* Ruby 1.9.3+
|
||||
* [JRuby][] 1.7+
|
||||
* [Rubinius][] 2+
|
||||
|
||||
|
||||
@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
|
||||
spec.homepage = 'https://github.com/lostisland/faraday'
|
||||
spec.licenses = ['MIT']
|
||||
|
||||
spec.required_ruby_version = '>= 1.9'
|
||||
|
||||
spec.add_dependency 'multipart-post', '>= 1.2', '< 3'
|
||||
|
||||
spec.files = `git ls-files -z lib LICENSE.md README.md`.split("\0")
|
||||
|
||||
@ -122,15 +122,6 @@ module Faraday
|
||||
@default_connection_options ||= ConnectionOptions.new
|
||||
end
|
||||
|
||||
if (!defined?(RUBY_ENGINE) || "ruby" == RUBY_ENGINE) && RUBY_VERSION < '1.9'
|
||||
begin
|
||||
require 'system_timer'
|
||||
Timer = SystemTimer
|
||||
rescue LoadError
|
||||
warn "Faraday: you may want to install system_timer for reliable timeouts"
|
||||
end
|
||||
end
|
||||
|
||||
unless const_defined? :Timer
|
||||
require 'timeout'
|
||||
Timer = Timeout
|
||||
|
||||
@ -20,11 +20,7 @@
|
||||
set -e
|
||||
|
||||
if [[ "$RUBYOPT" != *"bundler/setup"* ]]; then
|
||||
if [[ "$(ruby -v)" == "ruby 1.8."* ]]; then
|
||||
exec bundle exec "$0"
|
||||
else
|
||||
export RUBYOPT="-rbundler/setup $RUBYOPT"
|
||||
fi
|
||||
export RUBYOPT="-rbundler/setup $RUBYOPT"
|
||||
fi
|
||||
|
||||
port=3999
|
||||
|
||||
@ -5,16 +5,18 @@ module Adapters
|
||||
|
||||
def adapter() :em_synchrony end
|
||||
|
||||
Integration.apply(self, :Parallel) do
|
||||
# https://github.com/eventmachine/eventmachine/pull/289
|
||||
undef :test_timeout
|
||||
unless jruby?
|
||||
Integration.apply(self, :Parallel) do
|
||||
# https://github.com/eventmachine/eventmachine/pull/289
|
||||
undef :test_timeout
|
||||
|
||||
def test_binds_local_socket
|
||||
host = '1.2.3.4'
|
||||
conn = create_connection :request => { :bind => { :host => host } }
|
||||
#put conn.get('/who-am-i').body
|
||||
assert_equal host, conn.options[:bind][:host]
|
||||
def test_binds_local_socket
|
||||
host = '1.2.3.4'
|
||||
conn = create_connection :request => { :bind => { :host => host } }
|
||||
#put conn.get('/who-am-i').body
|
||||
assert_equal host, conn.options[:bind][:host]
|
||||
end
|
||||
end
|
||||
end unless RUBY_VERSION < '1.9' or jruby?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,8 +7,7 @@ module Adapters
|
||||
|
||||
def adapter() :net_http end
|
||||
|
||||
behaviors = [:NonParallel]
|
||||
behaviors << :Compression if RUBY_VERSION >= '1.9'
|
||||
behaviors = [:NonParallel, :Compression]
|
||||
|
||||
Integration.apply(self, *behaviors)
|
||||
|
||||
|
||||
@ -5,16 +5,17 @@ module Adapters
|
||||
|
||||
def adapter() :patron end
|
||||
|
||||
Integration.apply(self, :NonParallel) do
|
||||
# https://github.com/toland/patron/issues/34
|
||||
undef :test_PATCH_send_url_encoded_params
|
||||
unless jruby?
|
||||
Integration.apply(self, :NonParallel) do
|
||||
# https://github.com/toland/patron/issues/34
|
||||
undef :test_PATCH_send_url_encoded_params
|
||||
|
||||
# https://github.com/toland/patron/issues/52
|
||||
undef :test_GET_with_body
|
||||
|
||||
# no support for SSL peer verification
|
||||
undef :test_GET_ssl_fails_with_bad_cert if ssl_mode?
|
||||
end unless RUBY_VERSION < '1.9' or jruby?
|
||||
# https://github.com/toland/patron/issues/52
|
||||
undef :test_GET_with_body
|
||||
|
||||
# no support for SSL peer verification
|
||||
undef :test_GET_ssl_fails_with_bad_cert if ssl_mode?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -86,21 +86,19 @@ class CompositeReadIOTest < Faraday::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
unless RUBY_VERSION < '1.9'
|
||||
def test_read_from_multibyte
|
||||
File.open(File.dirname(__FILE__) + '/multibyte.txt') do |utf8|
|
||||
io = composite_io(part("\x86"), Part.new(utf8))
|
||||
assert_equal bin("\x86\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB\n"), io.read
|
||||
end
|
||||
def test_read_from_multibyte
|
||||
File.open(File.dirname(__FILE__) + '/multibyte.txt') do |utf8|
|
||||
io = composite_io(part("\x86"), Part.new(utf8))
|
||||
assert_equal bin("\x86\xE3\x83\x95\xE3\x82\xA1\xE3\x82\xA4\xE3\x83\xAB\n"), io.read
|
||||
end
|
||||
end
|
||||
|
||||
def test_limited_from_multibyte
|
||||
File.open(File.dirname(__FILE__) + '/multibyte.txt') do |utf8|
|
||||
io = composite_io(part("\x86"), Part.new(utf8))
|
||||
assert_equal bin("\x86\xE3\x83"), io.read(3)
|
||||
assert_equal bin("\x95\xE3\x82"), io.read(3)
|
||||
assert_equal bin("\xA1\xE3\x82\xA4\xE3\x83\xAB\n"), io.read(8)
|
||||
end
|
||||
def test_limited_from_multibyte
|
||||
File.open(File.dirname(__FILE__) + '/multibyte.txt') do |utf8|
|
||||
io = composite_io(part("\x86"), Part.new(utf8))
|
||||
assert_equal bin("\x86\xE3\x83"), io.read(3)
|
||||
assert_equal bin("\x95\xE3\x82"), io.read(3)
|
||||
assert_equal bin("\xA1\xE3\x82\xA4\xE3\x83\xAB\n"), io.read(8)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
if RUBY_VERSION >= '1.9'
|
||||
require 'simplecov'
|
||||
require 'coveralls'
|
||||
require 'simplecov'
|
||||
require 'coveralls'
|
||||
|
||||
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
||||
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]
|
||||
|
||||
SimpleCov.start do
|
||||
add_filter '/bundle/'
|
||||
add_filter '/test/'
|
||||
minimum_coverage(87)
|
||||
end
|
||||
SimpleCov.start do
|
||||
add_filter '/bundle/'
|
||||
add_filter '/test/'
|
||||
minimum_coverage(87)
|
||||
end
|
||||
|
||||
gem 'minitest' if defined? Bundler
|
||||
|
||||
@ -34,11 +34,7 @@ class OptionsTest < Faraday::TestCase
|
||||
options = SubOptions.new
|
||||
assert !options.key?(:sub)
|
||||
options.sub = 1
|
||||
if RUBY_VERSION >= '1.9'
|
||||
assert options.key?(:sub)
|
||||
else
|
||||
assert options.key?("sub")
|
||||
end
|
||||
assert options.key?(:sub)
|
||||
end
|
||||
|
||||
def test_each_value
|
||||
|
||||
@ -17,20 +17,6 @@ class RequestMiddlewareTest < Faraday::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def with_utf8
|
||||
if defined?(RUBY_VERSION) && RUBY_VERSION.match(/1.8.\d/)
|
||||
begin
|
||||
previous_kcode = $KCODE
|
||||
$KCODE = "UTF8"
|
||||
yield
|
||||
ensure
|
||||
$KCODE = previous_kcode
|
||||
end
|
||||
else
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def test_does_nothing_without_payload
|
||||
response = @conn.post('/echo')
|
||||
assert_nil response.headers['Content-Type']
|
||||
@ -80,16 +66,6 @@ class RequestMiddlewareTest < Faraday::TestCase
|
||||
assert err.empty?, "stderr did include: #{err}"
|
||||
end
|
||||
|
||||
def test_url_encoded_unicode_with_kcode_set
|
||||
with_utf8 do
|
||||
err = capture_warnings {
|
||||
response = @conn.post('/echo', {:str => "eé cç aã aâ"})
|
||||
assert_equal "str=e%C3%A9+c%C3%A7+a%C3%A3+a%C3%A2", response.body
|
||||
}
|
||||
assert err.empty?, "stderr did include: #{err}"
|
||||
end
|
||||
end
|
||||
|
||||
def test_url_encoded_nested_keys
|
||||
response = @conn.post('/echo', {'a'=>{'b'=>{'c'=>['d']}}})
|
||||
assert_equal "a%5Bb%5D%5Bc%5D%5B%5D=d", response.body
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user