Skip to content

Commit 194de58

Browse files
authored
fix: support and test activerecord 7.1 (#428)
1 parent cd2fac1 commit 194de58

File tree

13 files changed

+36
-32
lines changed

13 files changed

+36
-32
lines changed

.github/workflows/ci.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches:
1010
- master
11+
concurrency:
12+
group: ci-${{ github.head_ref }}
13+
cancel-in-progress: true
1114

1215
jobs:
1316
rspec:
@@ -37,18 +40,22 @@ jobs:
3740
fail-fast: false
3841
matrix:
3942
ruby:
43+
- '3.3'
4044
- '3.2'
4145
- '3.1'
4246
- '3.0'
43-
- '2.7'
4447
rails:
48+
- activerecord_7.1
4549
- activerecord_7.0
4650
- activerecord_6.1
47-
- activerecord_6.0
51+
- activerecord_edge
4852
adapter:
4953
- 'sqlite3:///:memory:'
5054
- mysql2://root:root@0/closure_tree_test
5155
- postgres://closure_tree:closure_tree@0/closure_tree_test
56+
exclude:
57+
- ruby: '3.0'
58+
rails: activerecord_edge
5259

5360
steps:
5461
- name: Checkout

.github/workflows/ci_jruby.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches:
1010
- master
11+
concurrency:
12+
group: ci-${{ github.head_ref }}-jruby
13+
cancel-in-progress: true
1114

1215
jobs:
1316
rspec:
@@ -43,7 +46,6 @@ jobs:
4346
- 'sqlite3:///:memory:'
4447
- mysql2://root:root@0/closure_tree_test
4548
- postgres://closure_tree:closure_tree@0/closure_tree_test
46-
4749
steps:
4850
- name: Checkout
4951
uses: actions/checkout@v3

.github/workflows/ci_truffleruby.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
pull_request:
99
branches:
1010
- master
11+
concurrency:
12+
group: ci-${{ github.head_ref }}-truffleruby
13+
cancel-in-progress: true
1114

1215
jobs:
1316
rspec:
@@ -41,7 +44,6 @@ jobs:
4144
rails:
4245
- activerecord_7.0
4346
- activerecord_6.1
44-
- activerecord_6.0
4547
adapter:
4648
- 'sqlite3:///:memory:'
4749
- mysql2://root:root@0/closure_tree_test

.tool-versions

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruby 3.0.5
1+
ruby 3.2.2

Appraisals

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

3-
appraise 'activerecord-6.0' do
4-
gem 'activerecord', '~> 6.0.0'
3+
appraise 'activerecord-6.1' do
4+
gem 'activerecord', '~> 6.1.0'
55
platforms :ruby do
66
gem 'mysql2'
77
gem 'pg'
@@ -15,8 +15,8 @@ appraise 'activerecord-6.0' do
1515
end
1616
end
1717

18-
appraise 'activerecord-6.1' do
19-
gem 'activerecord', '~> 6.1.0'
18+
appraise 'activerecord-7.0' do
19+
gem 'activerecord', '~> 7.0.0'
2020
platforms :ruby do
2121
gem 'mysql2'
2222
gem 'pg'
@@ -30,8 +30,8 @@ appraise 'activerecord-6.1' do
3030
end
3131
end
3232

33-
appraise 'activerecord-7.0' do
34-
gem 'activerecord', '~> 7.0.0'
33+
appraise 'activerecord-7.1' do
34+
gem 'activerecord', '~> 7.1.0'
3535
platforms :ruby do
3636
gem 'mysql2'
3737
gem 'pg'

_config.yml

-1
This file was deleted.

closure_tree.gemspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Gem::Specification.new do |gem|
1818
end
1919

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

23-
gem.add_runtime_dependency 'activerecord', '>= 6.0.0'
23+
gem.add_runtime_dependency 'activerecord', '>= 6.1.0'
2424
gem.add_runtime_dependency 'with_advisory_lock', '>= 4.0.0'
2525

2626
gem.add_development_dependency 'appraisal'

gemfiles/activerecord_6.0.gemfile renamed to gemfiles/activerecord_7.1.gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
source "https://rubygems.org"
44

5-
gem "activerecord", "~> 6.0.0"
5+
gem "activerecord", "~> 7.1.0"
66

77
platforms :mri do
88
group :development do

spec/support/schema.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
end
1717

1818
create_table 'uuid_tags', id: false, force: :cascade do |t|
19-
t.string 'uuid', unique: true
19+
t.string 'uuid', primary_key: true
2020
t.string 'name'
2121
t.string 'title'
2222
t.string 'parent_uuid'

test/closure_tree/label_test.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ def self.shared_examples(&block)
1212
end
1313

1414
it "should set order_value on roots" do
15-
assert_equal @expected_root_order_value, @root.order_value
15+
if @expected_root_order_value.nil?
16+
assert_nil @root.order_value
17+
else
18+
assert_equal @expected_root_order_value, @root.order_value
19+
end
1620
end
1721

1822
it "should set order_value with siblings" do
@@ -456,7 +460,7 @@ def roots_name_and_order
456460
it "should reorder old-parent siblings when a node moves to another tree" do
457461
f2 = Label.find_or_create_by_path %w[a2 b2 c2 d2 e2 f2]
458462
f3 = f2.prepend_sibling(Label.new(name: "f3"))
459-
f4 = f2.append_sibling(Label.new(name: "f4"))
463+
_f4 = f2.append_sibling(Label.new(name: "f4"))
460464
@f1.add_sibling(f2)
461465
assert_equal [0, 1], @f1.self_and_siblings.collect(&:order_value)
462466
assert_equal [0, 1], f3.self_and_siblings.collect(&:order_value)

test/support/query_counter.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ def sql_queries(&block)
1616

1717
def assert_database_queries_count(expected, &block)
1818
queries = sql_queries(&block)
19-
queries.count.must_equal(
19+
assert_equal(
2020
expected,
21+
queries.count,
2122
"Expected #{expected} queries, but found #{queries.count}:\n#{queries.join("\n")}"
2223
)
2324
end

test/support/tag_examples.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def assert_parent_and_children
442442
c = @tag_class.find_or_create_by_path %w[A B C]
443443
a = c.parent.parent
444444
b = c.parent
445-
spurious_tags = @tag_class.find_or_create_by_path %w[D E]
445+
_spurious_tags = @tag_class.find_or_create_by_path %w[D E]
446446
assert_equal [a, b], @tag_class.with_descendant(c).to_a
447447
end
448448

@@ -612,7 +612,7 @@ def assert_parent_and_children
612612
end
613613

614614
it 'finds correctly rooted paths' do
615-
decoy = @tag_class.find_or_create_by_path %w[a b c d]
615+
_decoy = @tag_class.find_or_create_by_path %w[a b c d]
616616
b_d = @tag_class.find_or_create_by_path %w[b c d]
617617
assert_equal b_d, @tag_class.find_by_path(%w[b c d])
618618
assert_nil @tag_class.find_by_path(%w[c d])

tests.sh

-11
This file was deleted.

0 commit comments

Comments
 (0)