Skip to content

Commit

Permalink
[D.299] Add tests for Rails 7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
FLeinzi committed Sep 4, 2024
1 parent 726ea6c commit 70a53e8
Show file tree
Hide file tree
Showing 22 changed files with 475 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,14 @@ jobs:
directory: 'spec/rails-7.0'
- ruby: 3.1.1
directory: 'spec/rails-7.1'
- ruby: 3.1.1
directory: 'spec/rails-7.2'
- ruby: 3.3.3
directory: 'spec/rails-7.0'
- ruby: 3.3.3
directory: 'spec/rails-7.1'
- ruby: 3.3.3
directory: 'spec/rails-7.2'
steps:
- uses: actions/checkout@v2
- name: Install ruby
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,20 @@ Rails.application.config.content_security_policy do |policy|

### Rails compatibility

The gem is tested to work with Rails 3.2+ and Ruby 2.5.8+.
The gem is tested against

| Versions | Ruby 2.5.8 | Ruby 2.6.6 | Ruby 2.7.2 | Ruby 3.0.0 | Ruby 3.1.1 | Ruby 3.3.3 |
|-----------|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|:------------------:|
| Rails 3.2 | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: |
| Rails 4.2 | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: | :x: |
| Rails 5.2 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: | :x: | :x: |
| Rails 6.1 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :x: |
| Rails 7.0 | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
| Rails 7.1 | :x: | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: |
| Rails 7.2 | :x: | :x: | :x: | :x: | :heavy_check_mark: | :heavy_check_mark: |


Later versions might work, earlier will not.

For Rails 2.3 and Ruby 1.8.7 support, use a version < 0.6.

Expand Down
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ end
def each_rails_version
Dir['spec/rails-*'].sort.each do |directory|
rails_version = /spec\/rails-(\d+\.\d+)/.match(directory)[1].to_f
if rails_version >= 7.0 && RUBY_VERSION < "2.7.0"
if rails_version >= 7.2 && RUBY_VERSION < "3.1.0"
puts "Skipping #{directory} since rails 7.2+ is not supported on ruby #{RUBY_VERSION}"
elsif rails_version >= 7.0 && RUBY_VERSION < "2.7.0"
puts "Skipping #{directory} since rails 7+ is not supported on ruby #{RUBY_VERSION}"
elsif rails_version < 5.0 && RUBY_VERSION >= "2.7.0"
puts "Skipping #{directory} since rails < 5 is not supported on ruby #{RUBY_VERSION}"
Expand Down
4 changes: 4 additions & 0 deletions spec/rails-7.2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.bundle
db/*.sqlite3
log/*.log
tmp/**/*
9 changes: 9 additions & 0 deletions spec/rails-7.2/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source 'https://rubygems.org'

gem 'sqlite3', '~> 1.7'
gem 'rails', '=7.2.1'
gem 'rspec'
gem 'rspec-rails'
gem 'database_cleaner'
gem 'query_diet', :path => '../..'
gem 'capybara'
236 changes: 236 additions & 0 deletions spec/rails-7.2/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
PATH
remote: ../..
specs:
query_diet (0.7.2)

GEM
remote: https://rubygems.org/
specs:
actioncable (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
actionmailer (7.2.1)
actionpack (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activesupport (= 7.2.1)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (7.2.1)
actionview (= 7.2.1)
activesupport (= 7.2.1)
nokogiri (>= 1.8.5)
racc
rack (>= 2.2.4, < 3.2)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (7.2.1)
actionpack (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.2.1)
activesupport (= 7.2.1)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (7.2.1)
activesupport (= 7.2.1)
globalid (>= 0.3.6)
activemodel (7.2.1)
activesupport (= 7.2.1)
activerecord (7.2.1)
activemodel (= 7.2.1)
activesupport (= 7.2.1)
timeout (>= 0.4.0)
activestorage (7.2.1)
actionpack (= 7.2.1)
activejob (= 7.2.1)
activerecord (= 7.2.1)
activesupport (= 7.2.1)
marcel (~> 1.0)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
bigdecimal (3.1.8)
builder (3.3.0)
capybara (3.40.0)
addressable
matrix
mini_mime (>= 0.1.3)
nokogiri (~> 1.11)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
database_cleaner (2.0.2)
database_cleaner-active_record (>= 2, < 3)
database_cleaner-active_record (2.2.0)
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
diff-lcs (1.5.1)
drb (2.2.1)
erubi (1.13.0)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
io-console (0.7.2)
irb (1.14.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
logger (1.6.1)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.4)
matrix (0.4.2)
mini_mime (1.1.5)
minitest (5.25.1)
net-imap (0.4.15)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
psych (5.1.2)
stringio
public_suffix (6.0.1)
racc (1.8.1)
rack (3.1.7)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.2.1)
actioncable (= 7.2.1)
actionmailbox (= 7.2.1)
actionmailer (= 7.2.1)
actionpack (= 7.2.1)
actiontext (= 7.2.1)
actionview (= 7.2.1)
activejob (= 7.2.1)
activemodel (= 7.2.1)
activerecord (= 7.2.1)
activestorage (= 7.2.1)
activesupport (= 7.2.1)
bundler (>= 1.15.0)
railties (= 7.2.1)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.2.1)
actionpack (= 7.2.1)
activesupport (= 7.2.1)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
rdoc (6.7.0)
psych (>= 4.0.0)
regexp_parser (2.9.2)
reline (0.5.9)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.1)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-rails (7.0.1)
actionpack (>= 7.0)
activesupport (>= 7.0)
railties (>= 7.0)
rspec-core (~> 3.13)
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
securerandom (0.3.1)
sqlite3 (1.7.3-x86_64-linux)
stringio (3.1.1)
thor (1.3.2)
timeout (0.4.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
useragent (0.16.10)
webrick (1.8.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.18)

PLATFORMS
x86_64-linux

DEPENDENCIES
capybara
database_cleaner
query_diet!
rails (= 7.2.1)
rspec
rspec-rails
sqlite3 (~> 1.7)

BUNDLED WITH
2.5.15
10 changes: 10 additions & 0 deletions spec/rails-7.2/Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'rake'
require 'rspec/core/rake_task'

desc 'Default: Run all specs for a specific rails version.'
task :default => :spec

desc "Run all specs for a specific rails version"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = defined?(SPEC) ? SPEC : ['../shared/spec/**/*_spec.rb']
end
1 change: 1 addition & 0 deletions spec/rails-7.2/app
38 changes: 38 additions & 0 deletions spec/rails-7.2/config/application.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
require File.expand_path('../boot', __FILE__)

require 'rails'
# Pick the frameworks you want:
require 'active_model/railtie'
require 'active_job/railtie'
require 'active_record/railtie'
# require 'active_storage/engine'
require 'action_controller/railtie'
require 'action_mailer/railtie'
# require 'action_mailbox/engine'
# require 'action_text/engine'
require 'action_view/railtie'
# require 'action_cable/engine'
# require 'sprockets/railtie'
require 'rails/test_unit/railtie'

# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env) if defined?(Bundler)


module QueryDietSpecApp
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.2

# Please, add to the `ignore` list any other `lib` subdirectories that do
# not contain `.rb` files, or that should not be reloaded or eager loaded.
# Common ones are `templates`, `generators`, or `middleware`, for example.
config.autoload_lib(ignore: %w(assets tasks))

config.encoding = "utf-8"
config.root = File.expand_path('../..', __FILE__)

# railties.plugins << Rails::Plugin.new(File.expand_path('../../../../..', __FILE__))
end
end
13 changes: 13 additions & 0 deletions spec/rails-7.2/config/boot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'rubygems'

# Set up gems listed in the Gemfile.
gemfile = File.expand_path('../../Gemfile', __FILE__)
begin
ENV['BUNDLE_GEMFILE'] = gemfile
require 'bundler'
Bundler.setup
rescue Bundler::GemNotFound => e
STDERR.puts e.message
STDERR.puts "Try running `bundle install`."
exit!
end if File.exist?(gemfile)
4 changes: 4 additions & 0 deletions spec/rails-7.2/config/database.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test:
adapter: sqlite3
database: db/query_diet_test.db
verbosity: quiet
5 changes: 5 additions & 0 deletions spec/rails-7.2/config/environment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
QueryDietSpecApp::Application.initialize!
Loading

0 comments on commit 70a53e8

Please sign in to comment.