Skip to content

Commit c18e412

Browse files
committed
Add MySQL2 to the test matrix
1 parent 3ab9269 commit c18e412

7 files changed

+245
-4
lines changed

.github/workflows/test.yml

+45
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,51 @@ on:
1010
- master
1111

1212
jobs:
13+
test_mysql:
14+
runs-on: ubuntu-24.04
15+
16+
services:
17+
mysql:
18+
image: mysql:5.7
19+
env:
20+
MYSQL_ROOT_PASSWORD: password
21+
ports:
22+
- 3306:3306
23+
options: >-
24+
--health-cmd="mysqladmin ping"
25+
--health-interval=10s
26+
--health-timeout=5s
27+
--health-retries=3
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
- ruby: 2.7.3
34+
gemfile: Gemfile.6.1.mysql2
35+
- ruby: 2.7.3
36+
gemfile: Gemfile.7.1.mysql2
37+
- ruby: 3.3.0
38+
gemfile: Gemfile.6.1.mysql2
39+
- ruby: 3.3.0
40+
gemfile: Gemfile.7.1.mysql2
41+
42+
env:
43+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
44+
45+
steps:
46+
- uses: actions/checkout@v3
47+
- name: Install ruby
48+
uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: ${{ matrix.ruby }}
51+
bundler-cache: true
52+
- name: Setup databases
53+
run: |
54+
mysql -e 'create database IF NOT EXISTS assignable_values_test;' -u root --password=password -P 3306 -h 127.0.0.1
55+
- name: Run tests
56+
run: bundle exec rspec
57+
1358
test_pg:
1459
runs-on: ubuntu-24.04
1560

Gemfile.6.1.mysql2

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
source 'https://rubygems.org'
2+
3+
# Runtime dependencies
4+
gem 'activerecord', '~>6.1.3'
5+
gem 'i18n'
6+
gem 'mysql2'
7+
8+
# Development dependencies
9+
gem 'rake'
10+
gem 'database_cleaner'
11+
gem 'rspec'
12+
gem 'rspec_candy'
13+
gem 'gemika', '~> 0.8.0'
14+
15+
# Gem under test
16+
gem 'assignable_values', :path => '.'

Gemfile.6.1.mysql2.lock

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
PATH
2+
remote: .
3+
specs:
4+
assignable_values (1.1.1)
5+
activerecord (>= 2.3)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
activemodel (6.1.7.10)
11+
activesupport (= 6.1.7.10)
12+
activerecord (6.1.7.10)
13+
activemodel (= 6.1.7.10)
14+
activesupport (= 6.1.7.10)
15+
activesupport (6.1.7.10)
16+
concurrent-ruby (~> 1.0, >= 1.0.2)
17+
i18n (>= 1.6, < 2)
18+
minitest (>= 5.1)
19+
tzinfo (~> 2.0)
20+
zeitwerk (~> 2.3)
21+
concurrent-ruby (1.3.4)
22+
database_cleaner (2.1.0)
23+
database_cleaner-active_record (>= 2, < 3)
24+
database_cleaner-active_record (2.2.0)
25+
activerecord (>= 5.a)
26+
database_cleaner-core (~> 2.0.0)
27+
database_cleaner-core (2.0.1)
28+
diff-lcs (1.6.0)
29+
gemika (0.8.4)
30+
i18n (1.14.7)
31+
concurrent-ruby (~> 1.0)
32+
minitest (5.25.4)
33+
mysql2 (0.5.6)
34+
rake (13.2.1)
35+
rspec (3.13.0)
36+
rspec-core (~> 3.13.0)
37+
rspec-expectations (~> 3.13.0)
38+
rspec-mocks (~> 3.13.0)
39+
rspec-core (3.13.3)
40+
rspec-support (~> 3.13.0)
41+
rspec-expectations (3.13.3)
42+
diff-lcs (>= 1.2.0, < 2.0)
43+
rspec-support (~> 3.13.0)
44+
rspec-mocks (3.13.2)
45+
diff-lcs (>= 1.2.0, < 2.0)
46+
rspec-support (~> 3.13.0)
47+
rspec-support (3.13.2)
48+
rspec_candy (0.5.1)
49+
rspec
50+
sneaky-save
51+
sneaky-save (0.1.3)
52+
activerecord (>= 3.2.0)
53+
tzinfo (2.0.6)
54+
concurrent-ruby (~> 1.0)
55+
zeitwerk (2.4.2)
56+
57+
PLATFORMS
58+
ruby
59+
60+
DEPENDENCIES
61+
activerecord (~> 6.1.3)
62+
assignable_values!
63+
database_cleaner
64+
gemika (~> 0.8.0)
65+
i18n
66+
mysql2
67+
rake
68+
rspec
69+
rspec_candy
70+
71+
BUNDLED WITH
72+
2.2.15

Gemfile.7.1.mysql2

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
source 'https://rubygems.org'
2+
3+
# Runtime dependencies
4+
gem 'activerecord', '~>7.1.3'
5+
gem 'i18n'
6+
gem 'mysql2'
7+
8+
# Development dependencies
9+
gem 'rake'
10+
gem 'database_cleaner'
11+
gem 'rspec'
12+
gem 'rspec_candy'
13+
gem 'gemika', '~> 0.8.0'
14+
15+
# Gem under test
16+
gem 'assignable_values', :path => '.'

Gemfile.7.1.mysql2.lock

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
PATH
2+
remote: .
3+
specs:
4+
assignable_values (1.1.1)
5+
activerecord (>= 2.3)
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
activemodel (7.1.5.1)
11+
activesupport (= 7.1.5.1)
12+
activerecord (7.1.5.1)
13+
activemodel (= 7.1.5.1)
14+
activesupport (= 7.1.5.1)
15+
timeout (>= 0.4.0)
16+
activesupport (7.1.5.1)
17+
base64
18+
benchmark (>= 0.3)
19+
bigdecimal
20+
concurrent-ruby (~> 1.0, >= 1.0.2)
21+
connection_pool (>= 2.2.5)
22+
drb
23+
i18n (>= 1.6, < 2)
24+
logger (>= 1.4.2)
25+
minitest (>= 5.1)
26+
mutex_m
27+
securerandom (>= 0.3)
28+
tzinfo (~> 2.0)
29+
base64 (0.2.0)
30+
benchmark (0.4.0)
31+
bigdecimal (3.1.9)
32+
concurrent-ruby (1.3.5)
33+
connection_pool (2.5.0)
34+
database_cleaner (2.1.0)
35+
database_cleaner-active_record (>= 2, < 3)
36+
database_cleaner-active_record (2.2.0)
37+
activerecord (>= 5.a)
38+
database_cleaner-core (~> 2.0.0)
39+
database_cleaner-core (2.0.1)
40+
diff-lcs (1.6.0)
41+
drb (2.2.1)
42+
gemika (0.8.4)
43+
i18n (1.14.7)
44+
concurrent-ruby (~> 1.0)
45+
logger (1.6.6)
46+
minitest (5.25.4)
47+
mutex_m (0.3.0)
48+
mysql2 (0.5.6)
49+
rake (13.2.1)
50+
rspec (3.13.0)
51+
rspec-core (~> 3.13.0)
52+
rspec-expectations (~> 3.13.0)
53+
rspec-mocks (~> 3.13.0)
54+
rspec-core (3.13.3)
55+
rspec-support (~> 3.13.0)
56+
rspec-expectations (3.13.3)
57+
diff-lcs (>= 1.2.0, < 2.0)
58+
rspec-support (~> 3.13.0)
59+
rspec-mocks (3.13.2)
60+
diff-lcs (>= 1.2.0, < 2.0)
61+
rspec-support (~> 3.13.0)
62+
rspec-support (3.13.2)
63+
rspec_candy (0.5.1)
64+
rspec
65+
sneaky-save
66+
securerandom (0.3.2)
67+
sneaky-save (0.1.3)
68+
activerecord (>= 3.2.0)
69+
timeout (0.4.3)
70+
tzinfo (2.0.6)
71+
concurrent-ruby (~> 1.0)
72+
73+
PLATFORMS
74+
ruby
75+
76+
DEPENDENCIES
77+
activerecord (~> 7.1.3)
78+
assignable_values!
79+
database_cleaner
80+
gemika (~> 0.8.0)
81+
i18n
82+
mysql2
83+
rake
84+
rspec
85+
rspec_candy
86+
87+
BUNDLED WITH
88+
2.2.15

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
We carefully enhanced the core enum functionality with small tweaks that are useful for web forms, internationalized applications and common authorization patterns.
2323

24-
`assignable_values` is tested with Rails 5.1, 6.1 and 7.1 on Ruby 2.5, 2.7 and 3.3.
24+
`assignable_values` is tested with Rails 6.1, 7.1 and 8.0 on Ruby 2.7 and 3.3.
2525

2626

2727
Restricting scalar attributes
@@ -443,7 +443,7 @@ Development
443443

444444
There are tests in `spec`. We only accept PRs with tests. To run tests:
445445

446-
- Install Ruby 2.3.8
446+
- Install Ruby 3.3.0
447447
- Create a local test database `assignable_values_test` in both MySQL and PostgreSQL (see
448448
`.github/workflows/test.yml` for commands to do so)
449449
- Copy `spec/support/database.sample.yml` to `spec/support/database.yml` and enter your local
@@ -459,7 +459,7 @@ We recommend to test large changes against multiple versions of Ruby and multipl
459459

460460
Note that we have configured GitHub Actions to automatically run tests in all supported Ruby versions and dependency sets after each push. We will only merge pull requests after a green GitHub Actions run.
461461

462-
I'm very eager to keep this gem leightweight and on topic. If you're unsure whether a change would make it into the gem, [talk to me beforehand](mailto:[email protected]).
462+
I'm very eager to keep this gem lightweight and on topic. If you're unsure whether a change would make it into the gem, [talk to me beforehand](mailto:[email protected]).
463463

464464

465465
Credits

spec/support/database.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
t.string :genre
1111
t.integer :year
1212
t.integer :duration
13-
t.string :multi_genres, :array => true
13+
if defined?(Mysql2)
14+
t.string :multi_genres
15+
else
16+
t.string :multi_genres, :array => true
17+
end
1418
t.json :metadata
1519
end
1620

0 commit comments

Comments
 (0)