Skip to content

Commit a3ada13

Browse files
authored
Update CI matrix to make sure recent Ruby and ActiveRecord versions are supported (#65)
* Update Ruby and Rails versions in CI matrix * Rails 8 needs Ruby 3.2 or higher * Rails 7.1 seems to wrap the error * Add Ruby 3.4 to the matrix * Comment on the proper line * Add comment why we want to continue on error * Include gems with older Rails versions This is actually only required for Ruby 3.4 compatibility. * Remove references about Rails 5, that's not supported anymore * Update local Ruby version to most recent one
1 parent 024da00 commit a3ada13

File tree

10 files changed

+20
-27
lines changed

10 files changed

+20
-27
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ concurrency:
88

99
jobs:
1010
tests:
11+
# Continue on error so that we see the results of all tests in the matrix.
1112
continue-on-error: true
1213
strategy:
1314
matrix:
14-
ruby: [ "3.3", "3.2", "3.1", "3.0" ]
15-
rails: [ "7.0", "6.1"]
16-
include:
17-
- { ruby: "2.7", rails: "6.0" }
18-
- { ruby: "2.7", rails: "5.2" }
19-
- { ruby: "2.7", rails: "5.1" }
20-
- { ruby: "2.7", rails: "5.0" }
15+
ruby: [ "3.4", "3.3", "3.2", "3.1" ]
16+
rails: [ "8.0", "7.1", "7.0", "6.1" ]
17+
exclude:
18+
# Rails 8 needs Ruby 3.2 or higher
19+
- { ruby: "3.1", rails: "8.0" }
2120
name: "tests (Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.rails }})"
2221
runs-on: ubuntu-latest
2322
env:

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.2
1+
3.4.1

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,6 @@ by default. But it's good to be aware of this in case you're running into
134134
weirdness.
135135

136136

137-
# Known issues
138-
* With Rails 5.0 in combination with uniqueness validations, ActiveRecord
139-
generates a wrong query. The `x` in front of the queried value, which casts
140-
the value to the proper data type, is missing.
141-
142-
143137
# Contributing
144138
To start coding on `mysql-binuuid-rails`, fork the project, clone it locally
145139
and then run `bin/setup` to get up and running. If you want to fool around in

test/gemfiles/rails-5.2.gemfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/gemfiles/rails-6.0.gemfile

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/gemfiles/rails-6.1.gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
source "https://rubygems.org"
22
gemspec path: "../.."
33
gem "activerecord", "~> 6.1.0"
4+
5+
gem "bigdecimal"
6+
gem "drb"
7+
gem "mutex_m"

test/gemfiles/rails-7.0.gemfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
source "https://rubygems.org"
22
gemspec path: "../.."
33
gem "activerecord", "~> 7.0.0"
4+
5+
gem "bigdecimal"
6+
gem "drb"
7+
gem "mutex_m"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
source "https://rubygems.org"
22
gemspec path: "../.."
3-
gem "activerecord", "~> 5.0.0"
3+
gem "activerecord", "~> 7.1.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
source "https://rubygems.org"
22
gemspec path: "../.."
3-
gem "activerecord", "~> 5.1.0"
3+
gem "activerecord", "~> 8.0.0"

test/integration/mysql_integration_test.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ class BeforePersistedTest < MySQLIntegrationTest
5353
end
5454

5555
test "validates uniqueness" do
56-
if ActiveRecord.version < Gem::Version.new("5.1.0")
57-
skip("Skipping uniqueness validation test, known issue on Rails/ActiveRecord 5.0")
58-
end
59-
6056
uuid = SecureRandom.uuid
6157
MyUuidModelWithValidations.create!(the_uuid: uuid)
6258
duplicate = MyUuidModelWithValidations.new(the_uuid: uuid)
@@ -106,7 +102,9 @@ class AfterPersistedTest < MySQLIntegrationTest
106102
end
107103

108104
test "can't be used to inject SQL using .where" do
109-
assert_raises MySQLBinUUID::InvalidUUID do
105+
# In Rails 7.1, the error gets wrapped in an ActiveRecord::StatementInvalid.
106+
expected_error = ActiveRecord.version.to_s.start_with?("7.1") ? ActiveRecord::StatementInvalid : MySQLBinUUID::InvalidUUID
107+
assert_raises(expected_error) do
110108
MyUuidModel.where(the_uuid: "' OR ''='").first
111109
end
112110
end

0 commit comments

Comments
 (0)