Skip to content

Commit 2579692

Browse files
authored
Add support for rails 8 (joshwlewis#55)
1 parent 22828df commit 2579692

File tree

7 files changed

+54
-40
lines changed

7 files changed

+54
-40
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ jobs:
1919
- mysql
2020
gemfile:
2121
- Gemfile
22+
- spec/ci/rails72.gemfile
2223
- spec/ci/rails71.gemfile
2324
- spec/ci/rails70.gemfile
25+
exclude:
26+
- gemfile: Gemfile
27+
- ruby-version: "3.1"
2428

2529
services:
2630
postgresql:

Gemfile.lock

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@ PATH
22
remote: .
33
specs:
44
validates_by_schema (0.5.2)
5-
activerecord (>= 6.0.0)
5+
activerecord (>= 7.0.0)
66

77
GEM
88
remote: https://rubygems.org/
99
specs:
10-
actionpack (7.2.1.2)
11-
actionview (= 7.2.1.2)
12-
activesupport (= 7.2.1.2)
10+
actionpack (8.0.0)
11+
actionview (= 8.0.0)
12+
activesupport (= 8.0.0)
1313
nokogiri (>= 1.8.5)
14-
racc
15-
rack (>= 2.2.4, < 3.2)
14+
rack (>= 2.2.4)
1615
rack-session (>= 1.0.1)
1716
rack-test (>= 0.6.3)
1817
rails-dom-testing (~> 2.2)
1918
rails-html-sanitizer (~> 1.6)
2019
useragent (~> 0.16)
21-
actionview (7.2.1.2)
22-
activesupport (= 7.2.1.2)
20+
actionview (8.0.0)
21+
activesupport (= 8.0.0)
2322
builder (~> 3.1)
2423
erubi (~> 1.11)
2524
rails-dom-testing (~> 2.2)
2625
rails-html-sanitizer (~> 1.6)
27-
activemodel (7.2.1.2)
28-
activesupport (= 7.2.1.2)
29-
activerecord (7.2.1.2)
30-
activemodel (= 7.2.1.2)
31-
activesupport (= 7.2.1.2)
26+
activemodel (8.0.0)
27+
activesupport (= 8.0.0)
28+
activerecord (8.0.0)
29+
activemodel (= 8.0.0)
30+
activesupport (= 8.0.0)
3231
timeout (>= 0.4.0)
33-
activesupport (7.2.1.2)
32+
activesupport (8.0.0)
3433
base64
34+
benchmark (>= 0.3)
3535
bigdecimal
3636
concurrent-ruby (~> 1.0, >= 1.3.1)
3737
connection_pool (>= 2.2.5)
@@ -41,7 +41,9 @@ GEM
4141
minitest (>= 5.1)
4242
securerandom (>= 0.3)
4343
tzinfo (~> 2.0, >= 2.0.5)
44+
uri (>= 0.13.1)
4445
base64 (0.2.0)
46+
benchmark (0.4.0)
4547
bigdecimal (3.1.8)
4648
builder (3.3.0)
4749
concurrent-ruby (1.3.4)
@@ -61,43 +63,42 @@ GEM
6163
loofah (2.23.1)
6264
crass (~> 1.0.2)
6365
nokogiri (>= 1.12.0)
64-
mini_portile2 (2.8.7)
65-
minitest (5.25.1)
66+
mini_portile2 (2.8.8)
67+
minitest (5.25.2)
6668
mysql2 (0.5.6)
6769
nokogiri (1.16.7)
6870
mini_portile2 (~> 2.8.2)
6971
racc (~> 1.4)
7072
pg (1.5.9)
71-
psych (5.1.2)
73+
psych (5.2.0)
7274
stringio
7375
racc (1.8.1)
7476
rack (3.1.8)
7577
rack-session (2.0.0)
7678
rack (>= 3.0.0)
7779
rack-test (2.1.0)
7880
rack (>= 1.3)
79-
rackup (2.1.0)
81+
rackup (2.2.1)
8082
rack (>= 3)
81-
webrick (~> 1.8)
8283
rails-dom-testing (2.2.0)
8384
activesupport (>= 5.0.0)
8485
minitest
8586
nokogiri (>= 1.6)
8687
rails-html-sanitizer (1.6.0)
8788
loofah (~> 2.21)
8889
nokogiri (~> 1.14)
89-
railties (7.2.1.2)
90-
actionpack (= 7.2.1.2)
91-
activesupport (= 7.2.1.2)
90+
railties (8.0.0)
91+
actionpack (= 8.0.0)
92+
activesupport (= 8.0.0)
9293
irb (~> 1.13)
9394
rackup (>= 1.0.0)
9495
rake (>= 12.2)
9596
thor (~> 1.0, >= 1.2.2)
9697
zeitwerk (~> 2.6)
9798
rake (13.2.1)
98-
rdoc (6.7.0)
99+
rdoc (6.8.1)
99100
psych (>= 4.0.0)
100-
reline (0.5.10)
101+
reline (0.5.12)
101102
io-console (~> 0.5)
102103
rspec-core (3.13.2)
103104
rspec-support (~> 3.13.0)
@@ -107,7 +108,7 @@ GEM
107108
rspec-mocks (3.13.2)
108109
diff-lcs (>= 1.2.0, < 2.0)
109110
rspec-support (~> 3.13.0)
110-
rspec-rails (7.0.1)
111+
rspec-rails (7.1.0)
111112
actionpack (>= 7.0)
112113
activesupport (>= 7.0)
113114
railties (>= 7.0)
@@ -116,7 +117,7 @@ GEM
116117
rspec-mocks (~> 3.13)
117118
rspec-support (~> 3.13)
118119
rspec-support (3.13.1)
119-
securerandom (0.3.1)
120+
securerandom (0.3.2)
120121
shoulda-matchers (6.4.0)
121122
activesupport (>= 5.2.0)
122123
simplecov (0.22.0)
@@ -126,16 +127,16 @@ GEM
126127
simplecov-html (0.13.1)
127128
simplecov-lcov (0.8.0)
128129
simplecov_json_formatter (0.1.4)
129-
sqlite3 (1.7.3)
130+
sqlite3 (2.3.1)
130131
mini_portile2 (~> 2.8.0)
131-
stringio (3.1.1)
132+
stringio (3.1.2)
132133
thor (1.3.2)
133-
timeout (0.4.1)
134+
timeout (0.4.2)
134135
tzinfo (2.0.6)
135136
concurrent-ruby (~> 1.0)
137+
uri (1.0.2)
136138
useragent (0.16.10)
137-
webrick (1.8.2)
138-
zeitwerk (2.6.18)
139+
zeitwerk (2.7.1)
139140

140141
PLATFORMS
141142
ruby
@@ -148,7 +149,7 @@ DEPENDENCIES
148149
shoulda-matchers
149150
simplecov
150151
simplecov-lcov
151-
sqlite3 (< 2.0)
152+
sqlite3
152153
validates_by_schema!
153154

154155
BUNDLED WITH

lib/validates_by_schema.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ def define_schema_validations
4040
end
4141

4242
def fetch_unique_indexes
43-
if connection.schema_cache.respond_to?(:indexes)
44-
connection.schema_cache.indexes(table_name).select(&:unique)
45-
else
46-
# Rails < 6.0
47-
connection.indexes(table_name).select(&:unique)
48-
end
43+
connection.schema_cache.indexes(table_name).select(&:unique)
4944
end
5045

5146
def customized_schema_validatable_columns

spec/ci/rails70.gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
22

33
gemspec path: '../..'
44

5+
gem 'sqlite3', '< 2.0'
6+
57
gem 'simplecov', require: false
68
gem 'simplecov-lcov', require: false
79

spec/ci/rails71.gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ source 'https://rubygems.org'
22

33
gemspec path: '../..'
44

5+
gem 'sqlite3', '< 2.0'
6+
57
gem 'simplecov', require: false
68
gem 'simplecov-lcov', require: false
79

spec/ci/rails72.gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
source 'https://rubygems.org'
2+
3+
gemspec path: '../..'
4+
5+
gem 'sqlite3', '< 2.0'
6+
7+
gem 'simplecov', require: false
8+
gem 'simplecov-lcov', require: false
9+
10+
gem 'activerecord', '~> 7.2.0'

validates_by_schema.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ Gem::Specification.new do |s|
2424
s.test_files = Dir['spec/**/*']
2525
s.require_paths = ['lib']
2626

27-
s.add_dependency 'activerecord', '>= 6.0.0'
27+
s.add_dependency 'activerecord', '>= 7.0.0'
2828

2929
s.add_development_dependency 'mysql2'
3030
s.add_development_dependency 'pg'
3131
s.add_development_dependency 'rake'
3232
s.add_development_dependency 'rspec-rails'
3333
s.add_development_dependency 'shoulda-matchers'
34-
s.add_development_dependency 'sqlite3', '< 2.0' # for the moment
34+
s.add_development_dependency 'sqlite3'
3535
end

0 commit comments

Comments
 (0)