Skip to content

Commit

Permalink
Merge pull request #546 from Shopify/fix-ci
Browse files Browse the repository at this point in the history
Fix CI and require Rails 7+ and Ruby 3+
  • Loading branch information
casperisfine authored Nov 23, 2023
2 parents 51de85d + 8f48924 commit 7486994
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
matrix:
entry:
- name: 'Minimum supported'
ruby: '2.7'
ruby: '3.0'
gemfile: "Gemfile.min-supported"
- name: 'Latest released & run rubocop'
ruby: '3.2'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gem "rubocop-shopify", "~> 2.9.0", require: false
gem "mysql2", "~> 0.5.3", platform: :mri
gem "pg", ">= 0.18", "< 2.0", platform: :mri
gem "memcached", "~> 1.8.0", platform: :mri
gem "memcached_store", "~> 1.0.0", platform: :mri
gem "memcached_store", "~> 2.3.2", platform: :mri
gem "dalli", "~> 2.7.11"
gem "cityhash", "~> 0.6.0", platform: :mri

Expand Down
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ up:
- [email protected]:
or: [[email protected]]
conflicts: [mysql-connector-c, mysql, mysql-client]
- ruby: 3.2.0
- ruby: 3.2.2
- isogun
- bundler

Expand Down
8 changes: 4 additions & 4 deletions gemfiles/Gemfile.min-supported
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ gemspec path: ".."

gem "ar_transaction_changes", "~> 1.1.0"

gem "activerecord", "~> 5.2.0"
gem "mysql2", "~> 0.4.4"
gem "pg", "~> 0.18.0"
gem "activerecord", "~> 7.0.0"
gem "mysql2", "~> 0.5"
gem "pg", "~> 1.1"
gem "memcached", "~> 1.8.0"
gem "memcached_store", "~> 1.0.0"
gem "memcached_store", "~> 2.3.2"
gem "dalli", "~> 2.7.11"
gem "cityhash", "~> 0.6.0"
6 changes: 3 additions & 3 deletions identity_cache.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ Gem::Specification.new do |gem|
gem.require_paths = ["lib"]
gem.version = IdentityCache::VERSION

gem.required_ruby_version = ">= 2.5.0"
gem.required_ruby_version = ">= 3.0.0"

gem.metadata["allowed_push_host"] = "https://rubygems.org"

gem.add_dependency("activerecord", ">= 5.2")
gem.add_dependency("activerecord", ">= 7.0")
gem.add_dependency("ar_transaction_changes", "~> 1.1")

gem.add_development_dependency("minitest", "~> 5.14")
gem.add_development_dependency("mocha", "~> 1.12")
gem.add_development_dependency("mocha", "~> 2.0")
gem.add_development_dependency("rake", "~> 13.0")
gem.add_development_dependency("spy", "~> 1.0")
end
2 changes: 1 addition & 1 deletion test/fetch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def test_fetch_by_title_hit
end

# Id not found, use sql, SELECT id FROM records WHERE title = '...' LIMIT 1"
Item.connection.expects(:exec_query).returns(ActiveRecord::Result.new(["id"], [[1]]))
Item.connection.expects(ar_query_method(Item.connection)).returns(ActiveRecord::Result.new(["id"], [[1]]))

result = Item.fetch_by_title("bob")
assert_instance_of(Item, result)
Expand Down
2 changes: 1 addition & 1 deletion test/index_cache_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_fetch_with_garbage_input
def test_fetch_with_unique_adds_limit_clause
Item.cache_index(:title, :id, unique: true)

Item.connection.expects(:exec_query)
Item.connection.expects(ar_query_method(Item.connection))
.with(regexp_matches(/ LIMIT [1?]\Z/i), any_parameters)
.returns(ActiveRecord::Result.new([], []))

Expand Down
2 changes: 1 addition & 1 deletion test/load_strategy/multi_load_request_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_after_load
id = n.next
letter = ("a".."z").to_a[n].to_sym
callback = proc {}
callback.expects(:call).with(id => letter)
callback.expects(:call).with({ id => letter })
LoadRequest.new([id], callback)
end
multi_load_request = MultiLoadRequest.new(load_requests)
Expand Down
9 changes: 8 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
DatabaseConnection.setup
CacheConnection.setup

MiniTest::Test = MiniTest::Unit::TestCase unless defined?(MiniTest::Test)
module IdentityCache
class TestCase < Minitest::Test
include ActiveRecordObjects
Expand Down Expand Up @@ -43,6 +42,14 @@ def teardown

private

def ar_query_method(connection)
if connection.respond_to?(:internal_exec_query, true)
:internal_exec_query
else
:exec_query
end
end

def create(class_symbol)
class_symbol.to_s.classify.constantize.create!
end
Expand Down

0 comments on commit 7486994

Please sign in to comment.