Skip to content

Commit

Permalink
Merge pull request #129 from Shopify/centralize_ruby_version
Browse files Browse the repository at this point in the history
Centralize Ruby Version to `.ruby-version`
  • Loading branch information
george-ma authored May 19, 2024
2 parents 1f696a3 + 1c8199d commit 1b635d9
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CI
on:
pull_request:
branches:
- '**'
push:
branches:
- master
jobs:
build:
name: Ruby ${{ matrix.version }}
runs-on: ubuntu-latest
strategy:
matrix:
version: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
steps:
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.version }}
bundler-cache: true
- name: Test
run: bundle exec rake test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ pkg/*
*.gem
.bundle
.DS_Store
Gemfile.lock
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.5
49 changes: 49 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
PATH
remote: .
specs:
active_utils (3.4.1)
activesupport (>= 4.2)
i18n

GEM
remote: https://rubygems.org/
specs:
activesupport (7.1.3.2)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
base64 (0.2.0)
bigdecimal (3.1.7)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
drb (2.2.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
minitest (5.22.3)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
mutex_m (0.2.0)
rake (13.2.0)
ruby2_keywords (0.0.5)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)

PLATFORMS
arm64-darwin-21
arm64-darwin-23
x86_64-linux

DEPENDENCIES
active_utils!
minitest
mocha
rake

BUNDLED WITH
2.4.18
1 change: 0 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ require 'rake/testtask'

Rake::TestTask.new(:test) do |t|
t.pattern = 'test/unit/**/*_test.rb'
t.ruby_opts << '-rubygems'
t.libs << 'test'
t.verbose = true
end
Expand Down
2 changes: 2 additions & 0 deletions active_utils.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Gem::Specification.new do |s|
s.summary = %q{Common utils used by active_merchant, active_fulfillment, and active_shipping}
s.license = 'MIT'

s.required_ruby_version = ">= 2.7"

s.rubyforge_project = "active_utils"

s.add_dependency('activesupport', '>= 4.2')
Expand Down
2 changes: 1 addition & 1 deletion lib/active_utils/country.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def to_s
{ :alpha2 => 'AF', :name => 'Afghanistan', :alpha3 => 'AFG', :numeric => '004' },
{ :alpha2 => 'AX', :name => 'Aland Islands', :alpha3 => 'ALA', :numeric => '248' },
{ :alpha2 => 'AL', :name => 'Albania', :alpha3 => 'ALB', :numeric => '008' },
{ :alpha2 => 'AC', :name => 'Ascension Island', :alpha3 => 'ASC' },
{ :alpha2 => 'DZ', :name => 'Algeria', :alpha3 => 'DZA', :numeric => '012' },
{ :alpha2 => 'AS', :name => 'American Samoa', :alpha3 => 'ASM', :numeric => '016' },
{ :alpha2 => 'AD', :name => 'Andorra', :alpha3 => 'AND', :numeric => '020' },
Expand All @@ -77,6 +76,7 @@ def to_s
{ :alpha2 => 'AR', :name => 'Argentina', :alpha3 => 'ARG', :numeric => '032' },
{ :alpha2 => 'AM', :name => 'Armenia', :alpha3 => 'ARM', :numeric => '051' },
{ :alpha2 => 'AW', :name => 'Aruba', :alpha3 => 'ABW', :numeric => '533' },
{ :alpha2 => 'AC', :name => 'Ascension Island', :alpha3 => 'ASC' },
{ :alpha2 => 'AU', :name => 'Australia', :alpha3 => 'AUS', :numeric => '036' },
{ :alpha2 => 'AT', :name => 'Austria', :alpha3 => 'AUT', :numeric => '040' },
{ :alpha2 => 'AZ', :name => 'Azerbaijan', :alpha3 => 'AZE', :numeric => '031' },
Expand Down
6 changes: 3 additions & 3 deletions test/unit/connection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def setup
end

def test_path_to_cert_is_correct
assert File.exists?(ActiveUtils::Connection::CA_FILE)
assert File.file?(ActiveUtils::Connection::CA_FILE)
end

def test_connection_endpoint_parses_string_to_uri
Expand Down Expand Up @@ -130,8 +130,8 @@ def test_override_ca_path
assert_equal "/bogus", @connection.send(:http).ca_path
end

def test_default_proxy_address_is_nil
assert_equal nil, @connection.proxy_address
def test_default_proxy_address_is_env
assert_equal :ENV, @connection.proxy_address
end

def test_default_proxy_port_is_nil
Expand Down
8 changes: 7 additions & 1 deletion test/unit/posts_data_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'active_support/core_ext/class'

class PostsDataTest < Minitest::Test

class SSLPoster
include PostsData

Expand Down Expand Up @@ -44,6 +43,8 @@ def test_logger_warns_if_ssl_strict_disabled

SSLPoster.ssl_strict = false
@poster.raw_ssl_request(:post, "https://shopify.com", "", {})
ensure
SSLPoster.ssl_strict = true
end

def test_logger_warns_can_handle_non_string_endpoints
Expand All @@ -65,10 +66,15 @@ def test_logger_no_warning_if_ssl_strict_enabled
end

def test_set_proxy_address_and_port
original_proxy_address = SSLPoster.proxy_address
original_proxy_port = SSLPoster.proxy_port
SSLPoster.proxy_address = 'http://proxy.example.com'
SSLPoster.proxy_port = '8888'
assert_equal @poster.proxy_address, 'http://proxy.example.com'
assert_equal @poster.proxy_port, '8888'
ensure
SSLPoster.proxy_address = original_proxy_address
SSLPoster.proxy_port = original_proxy_port
end

class HttpConnectionAbort < StandardError; end
Expand Down

0 comments on commit 1b635d9

Please sign in to comment.