Skip to content

Commit

Permalink
Running tests on rails 6.1 and 7.0 (#21)
Browse files Browse the repository at this point in the history
# Description ✍️

Add tests for rails 6.1 alongside rails 7.0 tests. The strategy to avoid
duplicate test files was
to use symbolic links to reuse most of rails 7 files.

- [x] Generate Gemfile and Gemfile.lock based on rails 6
- [x] Add config folder based on rails 6.1
- [x] Add an CI action to run rails 6.1 tests
  • Loading branch information
niltonvasques authored Apr 23, 2023
1 parent 1db6c2c commit 9f59a5b
Show file tree
Hide file tree
Showing 16 changed files with 347 additions and 6 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,29 @@ jobs:
with:
mongodb-version: ${{ matrix.mongodb-version }}

- name: Original Tests Mongoid Bundle
id: rspec-mongo-original-bundle
- name: Rails 7.0 Tests Mongoid Bundle
id: rspec-mongo-rails7-bundle
run: |
cd spec/tester_mongo
pwd
gem install bundler:2.4.12
bundle install -j 5
- name: Original Tests Mongoid
id: rspec-mongo-original
- name: Rails 7.0 Tests Mongoid
id: rspec-rails7
run: |
cd spec/tester_mongo
DRIVER=mongo rspec
RAILS_VERSION=7.0 DRIVER=mongo rspec
- name: Rails 6.1 Tests Mongoid Bundle
id: rspec-mongo-rails-6-bundle
run: |
cd spec/tester_mongo_rails_6
gem install bundler:2.4.12
bundle install -j 5
- name: Rails 6.1 Tests Mongoid
id: rspec-rails-6
run: |
cd spec/tester_mongo_rails_6
RAILS_VERSION=6.1 DRIVER=mongo rspec
3 changes: 2 additions & 1 deletion spec/tester_mongo/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

module DummyRailsApp
class Application < Rails::Application
RAILS_VERSION = ENV["RAILS_VERSION"] || 7.0
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 7.0
config.load_defaults RAILS_VERSION

# Configuration for the application, engines, and railties goes here.
#
Expand Down
33 changes: 33 additions & 0 deletions spec/tester_mongo_rails_6/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-*

# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep

# Ignore pidfiles, but keep the directory.
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep

# Ignore uploaded files in development.
/storage/*
!/storage/.keep
/tmp/storage/*
!/tmp/storage/
!/tmp/storage/.keep

# Ignore master key for decrypting credentials and more.
/config/master.key
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/.rspec
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/.ruby-version
58 changes: 58 additions & 0 deletions spec/tester_mongo_rails_6/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby ">= 2.7.0"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 6.1.0"

# Use sqlite3 as the database for Active Record
gem "sqlite3", "~> 1.4"

gem "mongoid"

# Use the Puma web server [https://github.com/puma/puma]
gem "puma", "~> 5.0"

# Use graphql gem for handle API
gem 'graphql', "~> 2.0.21"

gem 'graphoid', path: "../../", require: 'graphoid/graphoid'

# Build JSON APIs with ease [https://github.com/rails/jbuilder]
# gem "jbuilder"

# Use Redis adapter to run Action Cable in production
# gem "redis", "~> 4.0"

# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
# gem "kredis"

# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
gem "bcrypt", "~> 3.1.18"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", require: false

# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
# gem "image_processing", "~> 1.2"

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem "rack-cors"

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[ mri mingw x64_mingw ]
gem "graphiql-rails"
gem "pry-byebug"
gem "rspec-rails"
end

group :development do
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
# gem "spring"
end

225 changes: 225 additions & 0 deletions spec/tester_mongo_rails_6/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
PATH
remote: ../..
specs:
graphoid (1.0.0)
graphql (~> 2.0.21)
rails (>= 6.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
mail (>= 2.7.1)
actionmailer (6.1.7.3)
actionpack (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activesupport (= 6.1.7.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.7.3)
actionview (= 6.1.7.3)
activesupport (= 6.1.7.3)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.7.3)
actionpack (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
nokogiri (>= 1.8.5)
actionview (6.1.7.3)
activesupport (= 6.1.7.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.1.7.3)
activesupport (= 6.1.7.3)
globalid (>= 0.3.6)
activemodel (6.1.7.3)
activesupport (= 6.1.7.3)
activerecord (6.1.7.3)
activemodel (= 6.1.7.3)
activesupport (= 6.1.7.3)
activestorage (6.1.7.3)
actionpack (= 6.1.7.3)
activejob (= 6.1.7.3)
activerecord (= 6.1.7.3)
activesupport (= 6.1.7.3)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (6.1.7.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
bcrypt (3.1.18)
bootsnap (1.16.0)
msgpack (~> 1.2)
bson (4.15.0)
builder (3.2.4)
byebug (11.1.3)
coderay (1.1.3)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
debug (1.7.2)
irb (>= 1.5.0)
reline (>= 0.3.1)
diff-lcs (1.5.0)
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
graphiql-rails (1.9.0)
railties
sprockets-rails
graphql (2.0.21)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
io-console (0.6.0)
irb (1.6.4)
reline (>= 0.3.0)
loofah (2.20.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.18.0)
mongo (2.18.2)
bson (>= 4.14.1, < 5.0.0)
mongoid (8.0.3)
activemodel (>= 5.1, < 7.1, != 7.0.0)
mongo (>= 2.18.0, < 3.0.0)
ruby2_keywords (~> 0.0.5)
msgpack (1.7.0)
net-imap (0.3.4)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.1)
timeout
net-smtp (0.3.3)
net-protocol
nio4r (2.5.9)
nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
pry-byebug (3.10.1)
byebug (~> 11.0)
pry (>= 0.13, < 0.15)
puma (5.6.5)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.1.7.3)
actioncable (= 6.1.7.3)
actionmailbox (= 6.1.7.3)
actionmailer (= 6.1.7.3)
actionpack (= 6.1.7.3)
actiontext (= 6.1.7.3)
actionview (= 6.1.7.3)
activejob (= 6.1.7.3)
activemodel (= 6.1.7.3)
activerecord (= 6.1.7.3)
activestorage (= 6.1.7.3)
activesupport (= 6.1.7.3)
bundler (>= 1.15.0)
railties (= 6.1.7.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
railties (6.1.7.3)
actionpack (= 6.1.7.3)
activesupport (= 6.1.7.3)
method_source
rake (>= 12.2)
thor (~> 1.0)
rake (13.0.6)
reline (0.3.3)
io-console (~> 0.5)
rspec-core (3.12.1)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.5)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.11)
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-support (3.12.0)
ruby2_keywords (0.0.5)
sprockets (4.2.0)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.4.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sqlite3 (1.6.2-x86_64-linux)
thor (1.2.1)
timeout (0.3.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
websocket-driver (0.7.5)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.7)

PLATFORMS
x86_64-linux

DEPENDENCIES
bcrypt (~> 3.1.18)
bootsnap
debug
graphiql-rails
graphoid!
graphql (~> 2.0.21)
mongoid
pry-byebug
puma (~> 5.0)
rails (~> 6.1.0)
rspec-rails
sqlite3 (~> 1.4)
tzinfo-data

RUBY VERSION
ruby 3.2.2p53

BUNDLED WITH
2.4.12
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/README.md
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/Rakefile
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/app
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/bin
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/config
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/config.ru
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/public
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/spec
1 change: 1 addition & 0 deletions spec/tester_mongo_rails_6/storage

0 comments on commit 9f59a5b

Please sign in to comment.