diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 049e62c8..1e3f3435 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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' diff --git a/Gemfile b/Gemfile index 58ce7e67..9b8ee48c 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/dev.yml b/dev.yml index 602741a5..50b8e923 100644 --- a/dev.yml +++ b/dev.yml @@ -5,7 +5,7 @@ up: - mysql-client@5.7: or: [mysql@5.7] conflicts: [mysql-connector-c, mysql, mysql-client] - - ruby: 3.2.0 + - ruby: 3.2.2 - isogun - bundler diff --git a/gemfiles/Gemfile.min-supported b/gemfiles/Gemfile.min-supported index 8c85d373..16ffb3fa 100644 --- a/gemfiles/Gemfile.min-supported +++ b/gemfiles/Gemfile.min-supported @@ -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" diff --git a/identity_cache.gemspec b/identity_cache.gemspec index e2237738..c57fa8fb 100644 --- a/identity_cache.gemspec +++ b/identity_cache.gemspec @@ -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 diff --git a/test/fetch_test.rb b/test/fetch_test.rb index 08b4d06d..612fbdce 100644 --- a/test/fetch_test.rb +++ b/test/fetch_test.rb @@ -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) diff --git a/test/index_cache_test.rb b/test/index_cache_test.rb index f2892239..f80bd6cd 100644 --- a/test/index_cache_test.rb +++ b/test/index_cache_test.rb @@ -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([], [])) diff --git a/test/load_strategy/multi_load_request_test.rb b/test/load_strategy/multi_load_request_test.rb index ad31c56c..94aec97d 100644 --- a/test/load_strategy/multi_load_request_test.rb +++ b/test/load_strategy/multi_load_request_test.rb @@ -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) diff --git a/test/test_helper.rb b/test/test_helper.rb index 17f4366b..86f36b62 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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 @@ -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