Skip to content

Commit f081750

Browse files
authored
Merge pull request #7 from openfoodfoundation/ruby
Drop Ruby 3.1 and add Ruby 3.3, 3.4 and 4.0
2 parents 208c1ae + bf31606 commit f081750

4 files changed

Lines changed: 88 additions & 52 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
ruby-version: ['3.1', '3.2']
16+
ruby-version: ["3.2", "3.3", "3.4", "4.0"]
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v6
1919
- uses: ruby/setup-ruby@v1
2020
with:
2121
ruby-version: ${{ matrix.ruby-version }}

Gemfile.lock

Lines changed: 55 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,93 @@
11
PATH
22
remote: .
33
specs:
4-
rspec-sql (0.0.3)
4+
rspec-sql (0.0.4)
55
activesupport
66
rspec
77

88
GEM
99
remote: https://rubygems.org/
1010
specs:
11-
activemodel (7.1.3.2)
12-
activesupport (= 7.1.3.2)
13-
activerecord (7.1.3.2)
14-
activemodel (= 7.1.3.2)
15-
activesupport (= 7.1.3.2)
11+
activemodel (8.1.3)
12+
activesupport (= 8.1.3)
13+
activerecord (8.1.3)
14+
activemodel (= 8.1.3)
15+
activesupport (= 8.1.3)
1616
timeout (>= 0.4.0)
17-
activesupport (7.1.3.2)
17+
activesupport (8.1.3)
1818
base64
1919
bigdecimal
20-
concurrent-ruby (~> 1.0, >= 1.0.2)
20+
concurrent-ruby (~> 1.0, >= 1.3.1)
2121
connection_pool (>= 2.2.5)
2222
drb
2323
i18n (>= 1.6, < 2)
24+
json
25+
logger (>= 1.4.2)
2426
minitest (>= 5.1)
25-
mutex_m
26-
tzinfo (~> 2.0)
27-
ast (2.4.2)
28-
base64 (0.2.0)
29-
bigdecimal (3.1.6)
30-
concurrent-ruby (1.2.3)
31-
connection_pool (2.4.1)
32-
diff-lcs (1.5.1)
33-
drb (2.2.0)
34-
ruby2_keywords
35-
i18n (1.14.1)
27+
securerandom (>= 0.3)
28+
tzinfo (~> 2.0, >= 2.0.5)
29+
uri (>= 0.13.1)
30+
ast (2.4.3)
31+
base64 (0.3.0)
32+
bigdecimal (4.1.2)
33+
concurrent-ruby (1.3.6)
34+
connection_pool (3.0.2)
35+
diff-lcs (1.6.2)
36+
drb (2.2.3)
37+
i18n (1.14.8)
3638
concurrent-ruby (~> 1.0)
37-
json (2.7.2)
38-
language_server-protocol (3.17.0.3)
39-
minitest (5.22.2)
40-
mutex_m (0.2.0)
41-
parallel (1.24.0)
42-
parser (3.3.0.5)
39+
json (2.19.5)
40+
language_server-protocol (3.17.0.5)
41+
lint_roller (1.1.0)
42+
logger (1.7.0)
43+
minitest (6.0.6)
44+
drb (~> 2.0)
45+
prism (~> 1.5)
46+
parallel (1.28.0)
47+
parser (3.3.11.1)
4348
ast (~> 2.4.1)
4449
racc
45-
racc (1.7.3)
50+
prism (1.9.0)
51+
racc (1.8.1)
4652
rainbow (3.1.1)
47-
regexp_parser (2.9.0)
48-
rexml (3.2.6)
49-
rspec (3.13.0)
53+
regexp_parser (2.12.0)
54+
rspec (3.13.2)
5055
rspec-core (~> 3.13.0)
5156
rspec-expectations (~> 3.13.0)
5257
rspec-mocks (~> 3.13.0)
53-
rspec-core (3.13.0)
58+
rspec-core (3.13.6)
5459
rspec-support (~> 3.13.0)
55-
rspec-expectations (3.13.0)
60+
rspec-expectations (3.13.5)
5661
diff-lcs (>= 1.2.0, < 2.0)
5762
rspec-support (~> 3.13.0)
58-
rspec-mocks (3.13.0)
63+
rspec-mocks (3.13.8)
5964
diff-lcs (>= 1.2.0, < 2.0)
6065
rspec-support (~> 3.13.0)
61-
rspec-support (3.13.0)
62-
rubocop (1.63.1)
66+
rspec-support (3.13.7)
67+
rubocop (1.86.2)
6368
json (~> 2.3)
64-
language_server-protocol (>= 3.17.0)
65-
parallel (~> 1.10)
69+
language_server-protocol (~> 3.17.0.2)
70+
lint_roller (~> 1.1.0)
71+
parallel (>= 1.10)
6672
parser (>= 3.3.0.2)
6773
rainbow (>= 2.2.2, < 4.0)
68-
regexp_parser (>= 1.8, < 3.0)
69-
rexml (>= 3.2.5, < 4.0)
70-
rubocop-ast (>= 1.31.1, < 2.0)
74+
regexp_parser (>= 2.9.3, < 3.0)
75+
rubocop-ast (>= 1.49.0, < 2.0)
7176
ruby-progressbar (~> 1.7)
72-
unicode-display_width (>= 2.4.0, < 3.0)
73-
rubocop-ast (1.31.2)
74-
parser (>= 3.3.0.4)
77+
unicode-display_width (>= 2.4.0, < 4.0)
78+
rubocop-ast (1.49.1)
79+
parser (>= 3.3.7.2)
80+
prism (~> 1.7)
7581
ruby-progressbar (1.13.0)
76-
ruby2_keywords (0.0.5)
77-
sqlite3 (1.7.2-x86_64-linux)
78-
timeout (0.4.1)
82+
securerandom (0.4.1)
83+
sqlite3 (2.9.4-x86_64-linux-gnu)
84+
timeout (0.6.1)
7985
tzinfo (2.0.6)
8086
concurrent-ruby (~> 1.0)
81-
unicode-display_width (2.5.0)
87+
unicode-display_width (3.2.0)
88+
unicode-emoji (~> 4.1)
89+
unicode-emoji (4.2.0)
90+
uri (1.1.1)
8291

8392
PLATFORMS
8493
x86_64-linux

rspec-sql.gemspec

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
Gem::Specification.new do |s|
44
s.name = "rspec-sql"
5-
s.version = "0.0.3"
5+
s.version = "0.0.4"
66
s.summary = "RSpec::Sql matcher"
77
s.description = "RSpec matcher for database queries."
88
s.authors = ["Maikel Linke", "Open Food Network contributors"]
99
s.email = "maikel@openfoodnetwork.org.au"
1010
s.files = Dir["lib/**/*.rb"]
1111
s.homepage = "https://github.com/openfoodfoundation/rspec-sql"
1212
s.license = "AGPL-3.0-or-later"
13-
s.required_ruby_version = ">= 3.1", "< 4"
13+
s.required_ruby_version = ">= 3.2"
1414

1515
s.metadata = {
1616
"changelog_uri" =>
@@ -20,6 +20,6 @@ Gem::Specification.new do |s|
2020
"rubygems_mfa_required" => "true",
2121
}
2222

23-
s.add_runtime_dependency "activesupport"
24-
s.add_runtime_dependency "rspec"
23+
s.add_dependency "activesupport"
24+
s.add_dependency "rspec"
2525
end

spec/lib/rspec/sql_spec.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@
133133
end
134134

135135
it "prints user-friendly message expecting summary" do
136+
skip "testing old ruby" unless RUBY_VERSION < "3.4"
137+
136138
message = error_message do
137139
expect { User.last }.to query_database(
138140
update: { user: 1 }
@@ -156,6 +158,31 @@
156158
TXT
157159
end
158160

161+
it "prints user-friendly message expecting summary" do
162+
skip "testing new ruby" if RUBY_VERSION < "3.4"
163+
164+
message = error_message do
165+
expect { User.last }.to query_database(
166+
update: { user: 1 }
167+
)
168+
end
169+
170+
expect(message).to eq <<~TXT
171+
Expected database queries: {update: {user: 1}}
172+
Actual database queries: {select: {users: 1}}
173+
174+
Diff:
175+
@@ -1 +1 @@
176+
-:update => {user: 1},
177+
+:select => {users: 1},
178+
179+
180+
Full query log:
181+
182+
User Load SELECT "users".* FROM "users" ORDER BY "users"."id" DESC LIMIT ?
183+
TXT
184+
end
185+
159186
def error_message
160187
yield
161188
rescue RSpec::Expectations::ExpectationNotMetError => e

0 commit comments

Comments
 (0)