Skip to content

Commit

Permalink
fix: support and test activerecord 7.1 (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
seuros authored Jan 17, 2024
1 parent cd2fac1 commit 194de58
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 32 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
branches:
- master
concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true

jobs:
rspec:
Expand Down Expand Up @@ -37,18 +40,22 @@ jobs:
fail-fast: false
matrix:
ruby:
- '3.3'
- '3.2'
- '3.1'
- '3.0'
- '2.7'
rails:
- activerecord_7.1
- activerecord_7.0
- activerecord_6.1
- activerecord_6.0
- activerecord_edge
adapter:
- 'sqlite3:///:memory:'
- mysql2://root:root@0/closure_tree_test
- postgres://closure_tree:closure_tree@0/closure_tree_test
exclude:
- ruby: '3.0'
rails: activerecord_edge

steps:
- name: Checkout
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci_jruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
branches:
- master
concurrency:
group: ci-${{ github.head_ref }}-jruby
cancel-in-progress: true

jobs:
rspec:
Expand Down Expand Up @@ -43,7 +46,6 @@ jobs:
- 'sqlite3:///:memory:'
- mysql2://root:root@0/closure_tree_test
- postgres://closure_tree:closure_tree@0/closure_tree_test

steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci_truffleruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
pull_request:
branches:
- master
concurrency:
group: ci-${{ github.head_ref }}-truffleruby
cancel-in-progress: true

jobs:
rspec:
Expand Down Expand Up @@ -41,7 +44,6 @@ jobs:
rails:
- activerecord_7.0
- activerecord_6.1
- activerecord_6.0
adapter:
- 'sqlite3:///:memory:'
- mysql2://root:root@0/closure_tree_test
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.0.5
ruby 3.2.2
12 changes: 6 additions & 6 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

appraise 'activerecord-6.0' do
gem 'activerecord', '~> 6.0.0'
appraise 'activerecord-6.1' do
gem 'activerecord', '~> 6.1.0'
platforms :ruby do
gem 'mysql2'
gem 'pg'
Expand All @@ -15,8 +15,8 @@ appraise 'activerecord-6.0' do
end
end

appraise 'activerecord-6.1' do
gem 'activerecord', '~> 6.1.0'
appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
platforms :ruby do
gem 'mysql2'
gem 'pg'
Expand All @@ -30,8 +30,8 @@ appraise 'activerecord-6.1' do
end
end

appraise 'activerecord-7.0' do
gem 'activerecord', '~> 7.0.0'
appraise 'activerecord-7.1' do
gem 'activerecord', '~> 7.1.0'
platforms :ruby do
gem 'mysql2'
gem 'pg'
Expand Down
1 change: 0 additions & 1 deletion _config.yml

This file was deleted.

4 changes: 2 additions & 2 deletions closure_tree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
end

gem.test_files = gem.files.grep(%r{^spec/})
gem.required_ruby_version = '>= 2.7.7'
gem.required_ruby_version = '>= 3.0.0'

gem.add_runtime_dependency 'activerecord', '>= 6.0.0'
gem.add_runtime_dependency 'activerecord', '>= 6.1.0'
gem.add_runtime_dependency 'with_advisory_lock', '>= 4.0.0'

gem.add_development_dependency 'appraisal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

gem "activerecord", "~> 6.0.0"
gem "activerecord", "~> 7.1.0"

platforms :mri do
group :development do
Expand Down
2 changes: 1 addition & 1 deletion spec/support/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
end

create_table 'uuid_tags', id: false, force: :cascade do |t|
t.string 'uuid', unique: true
t.string 'uuid', primary_key: true
t.string 'name'
t.string 'title'
t.string 'parent_uuid'
Expand Down
8 changes: 6 additions & 2 deletions test/closure_tree/label_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ def self.shared_examples(&block)
end

it "should set order_value on roots" do
assert_equal @expected_root_order_value, @root.order_value
if @expected_root_order_value.nil?
assert_nil @root.order_value
else
assert_equal @expected_root_order_value, @root.order_value
end
end

it "should set order_value with siblings" do
Expand Down Expand Up @@ -456,7 +460,7 @@ def roots_name_and_order
it "should reorder old-parent siblings when a node moves to another tree" do
f2 = Label.find_or_create_by_path %w[a2 b2 c2 d2 e2 f2]
f3 = f2.prepend_sibling(Label.new(name: "f3"))
f4 = f2.append_sibling(Label.new(name: "f4"))
_f4 = f2.append_sibling(Label.new(name: "f4"))
@f1.add_sibling(f2)
assert_equal [0, 1], @f1.self_and_siblings.collect(&:order_value)
assert_equal [0, 1], f3.self_and_siblings.collect(&:order_value)
Expand Down
3 changes: 2 additions & 1 deletion test/support/query_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ def sql_queries(&block)

def assert_database_queries_count(expected, &block)
queries = sql_queries(&block)
queries.count.must_equal(
assert_equal(
expected,
queries.count,
"Expected #{expected} queries, but found #{queries.count}:\n#{queries.join("\n")}"
)
end
Expand Down
4 changes: 2 additions & 2 deletions test/support/tag_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def assert_parent_and_children
c = @tag_class.find_or_create_by_path %w[A B C]
a = c.parent.parent
b = c.parent
spurious_tags = @tag_class.find_or_create_by_path %w[D E]
_spurious_tags = @tag_class.find_or_create_by_path %w[D E]
assert_equal [a, b], @tag_class.with_descendant(c).to_a
end

Expand Down Expand Up @@ -612,7 +612,7 @@ def assert_parent_and_children
end

it 'finds correctly rooted paths' do
decoy = @tag_class.find_or_create_by_path %w[a b c d]
_decoy = @tag_class.find_or_create_by_path %w[a b c d]
b_d = @tag_class.find_or_create_by_path %w[b c d]
assert_equal b_d, @tag_class.find_by_path(%w[b c d])
assert_nil @tag_class.find_by_path(%w[c d])
Expand Down
11 changes: 0 additions & 11 deletions tests.sh

This file was deleted.

0 comments on commit 194de58

Please sign in to comment.