Skip to content

Commit

Permalink
Require Ruby 2.3 or higher
Browse files Browse the repository at this point in the history
Rubies older than 2.3.6 are outside maintenance, so this honestly seems
like the bare minimum for a payment gem.

Closes #2863
  • Loading branch information
bpollack committed Jun 4, 2018
1 parent e4bc536 commit 46a422f
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 40 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -11,7 +11,6 @@ rvm:
- 2.5
- 2.4
- 2.3
- 2.2

gemfile:
- Gemfile.rails52
Expand All @@ -21,7 +20,7 @@ gemfile:

matrix:
include:
- rvm: 2.1
- rvm: 2.3
gemfile: Gemfile.rails42

notifications:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -2,6 +2,7 @@

== HEAD
* Paymentez: return a Result object even when the upstream server 500s [bpollack] #2871
* Drop support for Ruby versions older than 2.3 [bpollack] #2863

== Version 1.79.2 (June 2, 2018)
* Fix Gateway#max_version= overwriting min_version [bdewater]
Expand Down
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -232,3 +232,7 @@ The [ActiveMerchant Wiki](http://github.com/activemerchant/active_merchant/wikis
## API stability policy

Functionality or APIs that are deprecated will be marked as such. Deprecated functionality is removed on major version changes - for example, deprecations from 2.x are removed in 3.x.

## Ruby and Rails compatibility policies

Because Active Merchant is a payment library, it needs to take security seriously. For this reason, Active Merchant guarantees compatibility only with actively supported versions of Ruby and Rails. At the time of this writing, that means that Ruby 2.3+ and Rails 4.2+ are supported.
2 changes: 1 addition & 1 deletion activemerchant.gemspec
Expand Up @@ -14,7 +14,7 @@ Gem::Specification.new do |s|
s.homepage = 'http://activemerchant.org/'
s.rubyforge_project = 'activemerchant'

s.required_ruby_version = '>= 2.1'
s.required_ruby_version = '>= 2.3'

s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'lib/**/*', 'vendor/**/*']
s.require_path = 'lib'
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
@@ -1,6 +1,6 @@
machine:
ruby:
version: '2.1.0'
version: '2.3.0'

dependencies:
cache_directories:
Expand Down
4 changes: 1 addition & 3 deletions lib/active_merchant/billing/gateways/cc5.rb
Expand Up @@ -190,10 +190,8 @@ def normalize(text)

if ActiveSupport::Inflector.method(:transliterate).arity == -2
ActiveSupport::Inflector.transliterate(text,'')
elsif RUBY_VERSION >= '1.9'
text.gsub(/[^\x00-\x7F]+/, '')
else
ActiveSupport::Inflector.transliterate(text).to_s
text.gsub(/[^\x00-\x7F]+/, '')
end
end
end
Expand Down
4 changes: 1 addition & 3 deletions lib/active_merchant/billing/gateways/garanti.rb
Expand Up @@ -197,10 +197,8 @@ def normalize(text)

if ActiveSupport::Inflector.method(:transliterate).arity == -2
ActiveSupport::Inflector.transliterate(text,'')
elsif RUBY_VERSION >= '1.9'
text.gsub(/[^\x00-\x7F]+/, '')
else
ActiveSupport::Inflector.transliterate(text).to_s
text.gsub(/[^\x00-\x7F]+/, '')
end
end

Expand Down
5 changes: 0 additions & 5 deletions test/remote/gateways/remote_finansbank_test.rb
Expand Up @@ -3,11 +3,6 @@

class RemoteFinansbankTest < Test::Unit::TestCase
def setup
if RUBY_VERSION < '1.9' && $KCODE == "NONE"
@original_kcode = $KCODE
$KCODE = 'u'
end

@gateway = FinansbankGateway.new(fixtures(:finansbank))

@amount = 100
Expand Down
5 changes: 0 additions & 5 deletions test/remote/gateways/remote_garanti_test.rb
Expand Up @@ -4,11 +4,6 @@
class RemoteGarantiTest < Test::Unit::TestCase

def setup
if RUBY_VERSION < '1.9' && $KCODE == "NONE"
@original_kcode = $KCODE
$KCODE = 'u'
end

@gateway = GarantiGateway.new(fixtures(:garanti))

@amount = 100 # 1 cents = 0.01$
Expand Down
4 changes: 0 additions & 4 deletions test/unit/gateways/finansbank_test.rb
Expand Up @@ -4,10 +4,6 @@
class FinansbankTest < Test::Unit::TestCase
def setup
@original_kcode = nil
if RUBY_VERSION < '1.9' && $KCODE == "NONE"
@original_kcode = $KCODE
$KCODE = 'u'
end

@gateway = FinansbankGateway.new(
:login => 'login',
Expand Down
9 changes: 1 addition & 8 deletions test/unit/gateways/garanti_test.rb
Expand Up @@ -5,10 +5,6 @@
class GarantiTest < Test::Unit::TestCase
def setup
@original_kcode = nil
if RUBY_VERSION < '1.9' && $KCODE == "NONE"
@original_kcode = $KCODE
$KCODE = 'u'
end

Base.mode = :test
@gateway = GarantiGateway.new(:login => 'a', :password => 'b', :terminal_id => 'c', :merchant_id => 'd')
Expand Down Expand Up @@ -51,12 +47,9 @@ def test_character_normalization
if ActiveSupport::Inflector.method(:transliterate).arity == -2
assert_equal 'ABCCDEFGGHIIJKLMNOOPRSSTUUVYZ', @gateway.send(:normalize, 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ')
assert_equal 'abccdefgghiijklmnooprsstuuvyz', @gateway.send(:normalize, 'abcçdefgğhıijklmnoöprsştuüvyz')
elsif RUBY_VERSION >= '1.9'
else
assert_equal 'ABCDEFGHIJKLMNOPRSTUVYZ', @gateway.send(:normalize, 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ')
assert_equal 'abcdefghijklmnoprstuvyz', @gateway.send(:normalize, 'abcçdefgğhıijklmnoöprsştuüvyz')
else
assert_equal 'ABCCDEFGGHIIJKLMNOOPRSSTUUVYZ', @gateway.send(:normalize, 'ABCÇDEFGĞHIİJKLMNOÖPRSŞTUÜVYZ')
assert_equal 'abccdefgghijklmnooprsstuuvyz', @gateway.send(:normalize, 'abcçdefgğhıijklmnoöprsştuüvyz')
end
end

Expand Down
11 changes: 3 additions & 8 deletions test/unit/network_connection_retries_test.rb
Expand Up @@ -32,10 +32,7 @@ def test_econnreset_raises_correctly
end

def test_timeout_errors_raise_correctly
exceptions = [Timeout::Error, Errno::ETIMEDOUT]
if RUBY_VERSION >= '2.0.0'
exceptions += [Net::ReadTimeout, Net::OpenTimeout]
end
exceptions = [Timeout::Error, Errno::ETIMEDOUT, Net::ReadTimeout, Net::OpenTimeout]

exceptions.each do |exception|
raised = assert_raises(ActiveMerchant::ConnectionError) do
Expand All @@ -57,10 +54,8 @@ def test_socket_error_raises_correctly
end

def test_ssl_errors_raise_correctly
exceptions = [OpenSSL::SSL::SSLError]
if RUBY_VERSION >= '2.1.0'
exceptions += [OpenSSL::SSL::SSLErrorWaitWritable, OpenSSL::SSL::SSLErrorWaitReadable]
end
exceptions = [OpenSSL::SSL::SSLError, OpenSSL::SSL::SSLErrorWaitWritable,
OpenSSL::SSL::SSLErrorWaitReadable]

exceptions.each do |exception|
raised = assert_raises(ActiveMerchant::ConnectionError) do
Expand Down

0 comments on commit 46a422f

Please sign in to comment.