diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6cab525 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +spec/**/*.html linguist-generated +spec/app_rails3/**/* linguist-generated +spec/app_rails4/**/* linguist-generated +spec/app_rails5/**/* linguist-generated +spec/app_rails7/**/* linguist-generated +gemfiles/* linguist-generated diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f2cea8d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,46 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:17 + ports: ['5432:5432'] + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_HOST_AUTH_METHOD: trust + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + strategy: + matrix: + rails-version: [3, 4, 5, 7] + + name: Test on Rails v${{ matrix.rails-version }} + + env: + BUNDLE_GEMFILE: "gemfiles/rails_${{ matrix.rails-version }}.gemfile" + BUNDLE_GEMS__RAILSLTS__COM: ${{ secrets.RAILS_LTS_CREDENTIALS }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Run tests + run: bundler exec rake rspec${{ matrix.rails-version }} diff --git a/.gitignore b/.gitignore index 24e3f90..0ffc8d8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ spec/app_rails*/log/*.log spec/app_rails*/tmp/ spec/app_rails*/.sass-cache *.un~ +.env +.idea diff --git a/.ruby-version b/.ruby-version index 00355e2..3b47f2e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.7 +3.3.9 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9a5c6d0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -langauge: ruby -sudo: false -cache: bundler - -before_install: - - gem uninstall bundler -x || gem uninstall bundler -a || true - - gem install -v 1.16.2 bundler - -matrix: - include: - - rvm: 2.3.7 - gemfile: gemfiles/rails_3.gemfile - env: TEST_APP_DIR=spec/app_rails3 - - rvm: 2.3.7 - gemfile: gemfiles/rails_4.gemfile - env: TEST_APP_DIR=spec/app_rails4 - - rvm: 2.3.7 - gemfile: gemfiles/rails_5.gemfile - env: TEST_APP_DIR=spec/app_rails5 - - rvm: 2.5.5 - gemfile: gemfiles/rails_4.gemfile - env: TEST_APP_DIR=spec/app_rails4 - - rvm: 2.5.5 - gemfile: gemfiles/rails_5.gemfile - env: TEST_APP_DIR=spec/app_rails5 - - -script: - - export APP_DIR=`pwd` - - bundle install - - cd $TEST_APP_DIR - - bundle exec rake db:create:all - - bundle exec rake db:environment:set RAILS_ENV=test - - bundle exec rake db:schema:load - - cd $APP_DIR - - bundle exec rspec -bundler_args: "" - -services: - - postgresql diff --git a/Appraisals b/Appraisals index 19ac2c8..d726400 100644 --- a/Appraisals +++ b/Appraisals @@ -1,29 +1,60 @@ appraise "rails-3" do - gem "rails", "~> 3.2.22.5" - gem "sqlite3" - gem "rspec-rails" + source "https://gems.railslts.com" do + gem "rails", "~> 3.2" + end + gem "rake", "~> 12.0" + gem "pg" + gem "rspec", "~> 2.14" + gem "rspec-rails", "~> 2.14" gem "rspec-its" gem "test-unit" - gem 'pg', '= 0.20' gem "pry" gem "strong_parameters" + gem "ruby3-backward-compatibility" + gem "bigdecimal" + gem "base64" + gem "racc" end appraise "rails-4" do - gem "rails", "~> 4.2.10" - gem "sqlite3" - gem "rspec-rails" + source "https://gems.railslts.com" do + gem "rails", "~> 4.2" + end + gem "rake", "~> 12.0" + gem "pg" + gem "rspec", "~> 3.0" + gem "rspec-rails", "~> 3.0" gem "rspec-its" - gem 'pg', '= 0.20' gem "pry" + gem "ruby3-backward-compatibility" + gem "mutex_m" + gem "bigdecimal" + gem "base64" end appraise "rails-5" do - gem "rails", "~> 5.2.1" + source "https://gems.railslts.com" do + gem "rails", "~> 5.2" + end + gem "rake", "~> 13.0" + gem "pg" gem "listen" - gem "sqlite3" - gem "rspec-rails" + gem "rspec", "~> 3.0" + gem "rspec-rails", "~> 5.0" + gem "rspec-its" + gem "pry" + gem "ruby3-backward-compatibility" + gem "mutex_m" + gem "bigdecimal" +end + +appraise "rails-7" do + gem "rails", "~> 7.2" + gem "rake", "~> 13.0" + gem "pg" + gem "listen" + gem "rspec", "~> 3.0" + gem "rspec-rails", "~> 8.0" gem "rspec-its" - gem 'pg' gem "pry" end diff --git a/Gemfile.lock b/Gemfile.lock index 7ba031b..cb3ae8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,110 +7,217 @@ PATH GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.1) - actionview (= 4.2.1) - activesupport (= 4.2.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - actionview (4.2.1) - activesupport (= 4.2.1) + actioncable (8.0.2.1) + actionpack (= 8.0.2.1) + activesupport (= 8.0.2.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (8.0.2.1) + actionpack (= 8.0.2.1) + activejob (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) + mail (>= 2.8.0) + actionmailer (8.0.2.1) + actionpack (= 8.0.2.1) + actionview (= 8.0.2.1) + activejob (= 8.0.2.1) + activesupport (= 8.0.2.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.0.2.1) + actionview (= 8.0.2.1) + activesupport (= 8.0.2.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.0.2.1) + actionpack (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (8.0.2.1) + activesupport (= 8.0.2.1) builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.1) - activejob (4.2.1) - activesupport (= 4.2.1) - globalid (>= 0.3.0) - activemodel (4.2.1) - activesupport (= 4.2.1) - builder (~> 3.1) - activerecord (4.2.1) - activemodel (= 4.2.1) - activesupport (= 4.2.1) - arel (~> 6.0) - activesupport (4.2.1) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.2.0) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (8.0.2.1) + activesupport (= 8.0.2.1) + globalid (>= 0.3.6) + activemodel (8.0.2.1) + activesupport (= 8.0.2.1) + activerecord (8.0.2.1) + activemodel (= 8.0.2.1) + activesupport (= 8.0.2.1) + timeout (>= 0.4.0) + activestorage (8.0.2.1) + actionpack (= 8.0.2.1) + activejob (= 8.0.2.1) + activerecord (= 8.0.2.1) + activesupport (= 8.0.2.1) + marcel (~> 1.0) + activesupport (8.0.2.1) + base64 + benchmark (>= 0.3) + 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) + uri (>= 0.13.1) + appraisal (2.5.0) bundler rake thor (>= 0.14.0) - arel (6.0.0) - builder (3.2.2) - concurrent-ruby (1.1.3) - erubis (2.7.0) - globalid (0.3.5) - activesupport (>= 4.1.0) - i18n (0.9.5) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.2.2) + builder (3.3.0) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) + crass (1.0.6) + date (3.4.1) + drb (2.2.3) + erb (5.0.2) + erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.1) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + logger (1.7.0) + loofah (2.24.1) + 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) + mini_mime (1.1.5) + minitest (5.25.5) + net-imap (0.5.9) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.9-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-musl) + racc (~> 1.4) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + psych (5.2.6) + date + stringio + racc (1.8.1) + rack (3.2.0) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.2.1) + rack (>= 3) + rails (8.0.2.1) + actioncable (= 8.0.2.1) + actionmailbox (= 8.0.2.1) + actionmailer (= 8.0.2.1) + actionpack (= 8.0.2.1) + actiontext (= 8.0.2.1) + actionview (= 8.0.2.1) + activejob (= 8.0.2.1) + activemodel (= 8.0.2.1) + activerecord (= 8.0.2.1) + activestorage (= 8.0.2.1) + activesupport (= 8.0.2.1) + bundler (>= 1.15.0) + railties (= 8.0.2.1) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.2.1) + actionpack (= 8.0.2.1) + activesupport (= 8.0.2.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.3.0) + rdoc (6.14.2) + erb + psych (>= 4.0.0) + reline (0.6.2) + io-console (~> 0.5) + securerandom (0.4.1) + stringio (3.1.7) + thor (1.4.0) + timeout (0.4.3) + tzinfo (2.0.6) concurrent-ruby (~> 1.0) - json (1.8.6) - loofah (2.0.2) - nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.5) - mini_portile (0.6.2) - minitest (5.11.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - rack (1.6.1) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.1) - actionmailer (= 4.2.1) - actionpack (= 4.2.1) - actionview (= 4.2.1) - activejob (= 4.2.1) - activemodel (= 4.2.1) - activerecord (= 4.2.1) - activesupport (= 4.2.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) - loofah (~> 2.0) - railties (4.2.1) - actionpack (= 4.2.1) - activesupport (= 4.2.1) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.1) - sprockets (3.1.0) - rack (~> 1.0) - sprockets-rails (2.3.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (>= 2.8, < 4.0) - thor (0.20.3) - thread_safe (0.3.6) - tzinfo (1.2.5) - thread_safe (~> 0.1) - wwtd (1.3.0) + uri (1.0.3) + useragent (0.16.11) + websocket-driver (0.8.0) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.7.3) PLATFORMS - ruby + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES appraisal modern_searchlogic! - wwtd + rake BUNDLED WITH - 1.16.2 + 2.7.1 diff --git a/Rakefile b/Rakefile index 53fe593..97a9cf5 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,85 @@ rescue LoadError puts 'You must `gem install bundler` and `bundle install` to run rake tasks' end +require 'rake' + +SUPPORTED_RAILS_VERSIONS = (3..5).to_a.concat([7]).freeze + +def convert_appraisal_to_gemfile(appraisal_name) + appraisal_name.tr('-', '_') +end + +def setup_database(gemfile_path, test_app_dir) + puts "Setting up database..." + + Dir.chdir(File.join(ENV['PROJECT_ROOT'], test_app_dir)) do + sh({'BUNDLE_GEMFILE' => gemfile_path}, 'bundle exec rake db:create:all') || exit(1) + sh({'BUNDLE_GEMFILE' => gemfile_path}, 'bundle exec rake db:environment:set RAILS_ENV=test') || exit(1) + sh({'BUNDLE_GEMFILE' => gemfile_path}, 'bundle exec rake db:schema:load') || exit(1) + end +end + +def find_spec_files + Dir.chdir(ENV['PROJECT_ROOT']) do + Dir.glob('spec/**/*_spec.rb') + .reject { |file| file.match?(/spec\/app_rails.*\//) } + .map { |file| File.expand_path(file) } + end +end + +def run_specs(gemfile_path, test_app_dir, spec_files) + current_rubylib = ENV['RUBYLIB'] || '' + spec_path = File.join(ENV['PROJECT_ROOT'], 'spec') + ENV['RUBYLIB'] = current_rubylib.empty? ? spec_path : "#{spec_path}:#{current_rubylib}" + + ENV['RAILS_ROOT'] = File.join(ENV['PROJECT_ROOT'], test_app_dir) + + Dir.chdir(File.join(ENV['PROJECT_ROOT'], test_app_dir)) do + ruby3_compat = File.join(ENV['PROJECT_ROOT'], 'spec', 'ruby3_compatibility') + + cmd = [ + 'bundle', 'exec', 'ruby', + '-r', ruby3_compat, + '-e', "require 'rspec/core'; RSpec::Core::Runner.run(ARGV)", + *spec_files + ] + + sh({'BUNDLE_GEMFILE' => gemfile_path}, *cmd) || exit(1) + end +end + +def run_specs_for_version(appraisal_name, test_app_dir) + ENV['POSTGRES_URL'] ||= 'postgres://postgres:password@localhost:5432/postgres' + ENV['RAILS_ENV'] ||= 'test' + ENV['PROJECT_ROOT'] ||= `git rev-parse --show-toplevel`.strip + + gemfile_name = convert_appraisal_to_gemfile(appraisal_name) + gemfile_path = File.join(ENV['PROJECT_ROOT'], 'gemfiles', "#{gemfile_name}.gemfile") + + puts "Running specs for #{appraisal_name} in #{test_app_dir}" + puts "Using gemfile: #{gemfile_name}.gemfile" + + setup_database(gemfile_path, test_app_dir) + spec_files = find_spec_files + run_specs(gemfile_path, test_app_dir, spec_files) + puts "Specs completed for #{appraisal_name}" +end + +SUPPORTED_RAILS_VERSIONS.each do |version| + desc "Run specs for Rails #{version}" + task "rspec#{version}" do + run_specs_for_version("rails-#{version}", "spec/app_rails#{version}") + end +end + +desc "Run specs for all versions of Rails" +task "test" => SUPPORTED_RAILS_VERSIONS.map { |it| "rspec#{it}".to_sym } + +desc "Install appraisals" +task "install_appraisals" do + sh("bundler exec appraisal install") +end + require 'rdoc/task' RDoc::Task.new(:rdoc) do |rdoc| @@ -14,13 +93,4 @@ RDoc::Task.new(:rdoc) do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end - - - - - Bundler::GemHelper.install_tasks - -require 'wwtd/tasks' - -task :default => :wwtd diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d05edea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +services: + postgres: + image: postgres:16 + environment: + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - "5432:5432" diff --git a/gemfiles/rails_3.gemfile b/gemfiles/rails_3.gemfile index 0a6a9fd..5f81ce9 100644 --- a/gemfiles/rails_3.gemfile +++ b/gemfiles/rails_3.gemfile @@ -2,13 +2,21 @@ source "https://rubygems.org" -gem "rails", "~> 3.2.22.5" -gem "sqlite3" -gem "rspec-rails" +gem "rake", "~> 12.0" +gem "pg" +gem "rspec", "~> 2.14" +gem "rspec-rails", "~> 2.14" gem "rspec-its" gem "test-unit" -gem "pg", "= 0.20" gem "pry" gem "strong_parameters" +gem "ruby3-backward-compatibility" +gem "bigdecimal" +gem "base64" +gem "racc" + +source "https://gems.railslts.com" do + gem "rails", "~> 3.2" +end gemspec path: "../" diff --git a/gemfiles/rails_3.gemfile.lock b/gemfiles/rails_3.gemfile.lock index 69ba09f..7ac1cf2 100644 --- a/gemfiles/rails_3.gemfile.lock +++ b/gemfiles/rails_3.gemfile.lock @@ -5,143 +5,164 @@ PATH rails (>= 3.2.14) GEM - remote: https://rubygems.org/ + remote: https://gems.railslts.com/ specs: - actionmailer (3.2.22.5) - actionpack (= 3.2.22.5) + actionmailer (3.2.22.50) + actionpack (= 3.2.22.50) mail (~> 2.5.4) - actionpack (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) + actionpack (3.2.22.50) + activemodel (= 3.2.22.50) + activesupport (= 3.2.22.50) + builder (~> 3.0) erubis (~> 2.7.0) journey (~> 1.0.4) rack (~> 1.4.5) rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.22.5) - activesupport (= 3.2.22.5) - builder (~> 3.0.0) - activerecord (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) + sprockets (= 2.2.3) + activemodel (3.2.22.50) + activesupport (= 3.2.22.50) + builder (~> 3.0) + activerecord (3.2.22.50) + activemodel (= 3.2.22.50) + activesupport (= 3.2.22.50) arel (~> 3.0.2) - tzinfo (~> 0.3.29) - activeresource (3.2.22.5) - activemodel (= 3.2.22.5) - activesupport (= 3.2.22.5) - activesupport (3.2.22.5) - i18n (~> 0.6, >= 0.6.4) + tzinfo (~> 0.3.61) + activeresource (3.2.22.50) + activemodel (= 3.2.22.50) + activesupport (= 3.2.22.50) + activesupport (3.2.22.50) + i18n (>= 0.6.4, < 2) multi_json (~> 1.0) - appraisal (2.2.0) + rack (1.4.7.24) + rails (3.2.22.50) + actionmailer (= 3.2.22.50) + actionpack (= 3.2.22.50) + activemodel (= 3.2.22.50) + activerecord (= 3.2.22.50) + activeresource (= 3.2.22.50) + activesupport (= 3.2.22.50) + bundler (>= 1.0) + railties (= 3.2.22.50) + railties (3.2.22.50) + actionpack (= 3.2.22.50) + activesupport (= 3.2.22.50) + rack-ssl (~> 1.3) + rake (>= 0.8.7) + thor (>= 0.14.6, < 2.0) + +GEM + remote: https://rubygems.org/ + specs: + appraisal (2.5.0) bundler rake thor (>= 0.14.0) arel (3.0.3) - builder (3.0.4) - coderay (1.1.2) - concurrent-ruby (1.1.3) - diff-lcs (1.3) + base64 (0.3.0) + bigdecimal (3.2.2) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.5) + diff-lcs (1.6.2) erubis (2.7.0) hike (1.2.3) - i18n (0.9.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) journey (1.0.4) - json (1.8.6) mail (2.5.5) mime-types (~> 1.16) treetop (~> 1.4.8) - method_source (0.9.1) + method_source (1.1.0) mime-types (1.25.1) - multi_json (1.13.1) - pg (0.20.0) + multi_json (1.17.0) + pg (1.6.1) + pg (1.6.1-aarch64-linux) + pg (1.6.1-aarch64-linux-musl) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-darwin) + pg (1.6.1-x86_64-linux) + pg (1.6.1-x86_64-linux-musl) polyglot (0.3.5) - power_assert (1.1.3) - pry (0.12.0) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - rack (1.4.7) - rack-cache (1.8.0) + power_assert (2.0.5) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + racc (1.8.1) + rack-cache (1.17.0) rack (>= 0.4) - rack-ssl (1.3.4) + rack-ssl (1.4.1) rack rack-test (0.6.3) rack (>= 1.0) - rails (3.2.22.5) - actionmailer (= 3.2.22.5) - actionpack (= 3.2.22.5) - activerecord (= 3.2.22.5) - activeresource (= 3.2.22.5) - activesupport (= 3.2.22.5) - bundler (~> 1.0) - railties (= 3.2.22.5) - railties (3.2.22.5) - actionpack (= 3.2.22.5) - activesupport (= 3.2.22.5) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (12.3.1) - rdoc (3.12.2) - json (~> 1.4) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-its (1.2.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.8.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.1) + rake (12.3.3) + rspec (2.99.0) + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + rspec-collection_matchers (1.2.1) + rspec-expectations (>= 2.99.0.beta1) + rspec-core (2.99.2) + rspec-expectations (2.99.2) + diff-lcs (>= 1.1.3, < 2.0) + rspec-its (1.0.1) + rspec-core (>= 2.99.0.beta1) + rspec-expectations (>= 2.99.0.beta1) + rspec-mocks (2.99.4) + rspec-rails (2.99.0) actionpack (>= 3.0) + activemodel (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) + rspec-collection_matchers + rspec-core (~> 2.99.0) + rspec-expectations (~> 2.99.0) + rspec-mocks (~> 2.99.0) + ruby3-backward-compatibility (1.5.0) sprockets (2.2.3) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.13) strong_parameters (0.2.3) actionpack (~> 3.0) activemodel (~> 3.0) activesupport (~> 3.0) railties (~> 3.0) - test-unit (3.2.8) + test-unit (3.7.0) power_assert - thor (0.20.0) + thor (1.4.0) tilt (1.4.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.55) - wwtd (1.3.0) + tzinfo (0.3.62) PLATFORMS + aarch64-linux + aarch64-linux-musl + arm64-darwin ruby + x86_64-darwin + x86_64-linux + x86_64-linux-musl DEPENDENCIES appraisal + base64 + bigdecimal modern_searchlogic! - pg (= 0.20) + pg pry - rails (~> 3.2.22.5) + racc + rails (~> 3.2)! + rake (~> 12.0) + rspec (~> 2.14) rspec-its - rspec-rails - sqlite3 + rspec-rails (~> 2.14) + ruby3-backward-compatibility strong_parameters test-unit - wwtd BUNDLED WITH - 1.16.2 + 2.7.1 diff --git a/gemfiles/rails_4.gemfile b/gemfiles/rails_4.gemfile index e62c475..ea51a70 100644 --- a/gemfiles/rails_4.gemfile +++ b/gemfiles/rails_4.gemfile @@ -2,11 +2,19 @@ source "https://rubygems.org" -gem "rails", "~> 4.2.10" -gem "sqlite3" -gem "rspec-rails" +gem "rake", "~> 12.0" +gem "pg" +gem "rspec", "~> 3.0" +gem "rspec-rails", "~> 3.0" gem "rspec-its" -gem "pg", "= 0.20" gem "pry" +gem "ruby3-backward-compatibility" +gem "mutex_m" +gem "bigdecimal" +gem "base64" + +source "https://gems.railslts.com" do + gem "rails", "~> 4.2" +end gemspec path: "../" diff --git a/gemfiles/rails_4.gemfile.lock b/gemfiles/rails_4.gemfile.lock index 6e4bc50..0a64dae 100644 --- a/gemfiles/rails_4.gemfile.lock +++ b/gemfiles/rails_4.gemfile.lock @@ -5,147 +5,205 @@ PATH rails (>= 3.2.14) GEM - remote: https://rubygems.org/ + remote: https://gems.railslts.com/ specs: - actionmailer (4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) + actionmailer (4.2.11.40) + actionpack (= 4.2.11.40) + actionview (= 4.2.11.40) + activejob (= 4.2.11.40) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.10) - actionview (= 4.2.10) - activesupport (= 4.2.10) + actionpack (4.2.11.40) + actionview (= 4.2.11.40) + activesupport (= 4.2.11.40) rack (~> 1.6) rack-test (~> 0.6.2) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.10) - activesupport (= 4.2.10) + actionview (4.2.11.40) + activesupport (= 4.2.11.40) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (4.2.10) - activesupport (= 4.2.10) + activejob (4.2.11.40) + activesupport (= 4.2.11.40) globalid (>= 0.3.0) - activemodel (4.2.10) - activesupport (= 4.2.10) + activemodel (4.2.11.40) + activesupport (= 4.2.11.40) builder (~> 3.1) - activerecord (4.2.10) - activemodel (= 4.2.10) - activesupport (= 4.2.10) + activerecord (4.2.11.40) + activemodel (= 4.2.11.40) + activesupport (= 4.2.11.40) arel (~> 6.0) - activesupport (4.2.10) - i18n (~> 0.7) + activesupport (4.2.11.40) + i18n (>= 0.7, < 2) minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.2.0) + tzinfo (~> 1.2, >= 1.2.10) + rack (1.6.13.22) + rails (4.2.11.40) + actionmailer (= 4.2.11.40) + actionpack (= 4.2.11.40) + actionview (= 4.2.11.40) + activejob (= 4.2.11.40) + activemodel (= 4.2.11.40) + activerecord (= 4.2.11.40) + activesupport (= 4.2.11.40) + bundler (>= 1.3.0) + railties (= 4.2.11.40) + sprockets-rails + railties (4.2.11.40) + actionpack (= 4.2.11.40) + activesupport (= 4.2.11.40) + rake (>= 0.8.7) + thor (>= 0.18.1, < 2.0) + +GEM + remote: https://rubygems.org/ + specs: + appraisal (2.5.0) bundler rake thor (>= 0.14.0) arel (6.0.4) - builder (3.2.3) - coderay (1.1.2) - concurrent-ruby (1.1.5) - crass (1.0.4) - diff-lcs (1.3) + base64 (0.3.0) + bigdecimal (3.2.2) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1) + diff-lcs (1.6.2) erubis (2.7.0) - globalid (0.4.1) + globalid (0.4.2) activesupport (>= 4.2.0) - i18n (0.9.5) + i18n (1.14.7) concurrent-ruby (~> 1.0) - loofah (2.2.3) + loofah (2.24.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - method_source (0.9.1) - mini_mime (1.0.1) - mini_portile2 (2.4.0) - minitest (5.11.3) - nokogiri (1.10.4) - mini_portile2 (~> 2.4.0) - pg (0.20.0) - pry (0.12.0) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - rack (1.6.11) + net-imap + net-pop + net-smtp + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.5) + mutex_m (0.3.0) + net-imap (0.5.9) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nokogiri (1.18.9-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-musl) + racc (~> 1.4) + pg (1.6.1) + pg (1.6.1-aarch64-linux) + pg (1.6.1-aarch64-linux-musl) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-darwin) + pg (1.6.1-x86_64-linux) + pg (1.6.1-x86_64-linux-musl) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + racc (1.8.1) rack-test (0.6.3) rack (>= 1.0) - rails (4.2.10) - actionmailer (= 4.2.10) - actionpack (= 4.2.10) - actionview (= 4.2.10) - activejob (= 4.2.10) - activemodel (= 4.2.10) - activerecord (= 4.2.10) - activesupport (= 4.2.10) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.10) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) + rails-deprecated_sanitizer (1.0.4) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.9) activesupport (>= 4.2.0, < 5.0) nokogiri (~> 1.6) rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (4.2.10) - actionpack (= 4.2.10) - activesupport (= 4.2.10) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (12.3.1) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + rake (12.3.3) + rspec (3.9.0) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-core (3.9.3) + rspec-support (~> 3.9.3) + rspec-expectations (3.9.4) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-its (1.2.0) + rspec-support (~> 3.9.0) + rspec-its (1.3.1) rspec-core (>= 3.0.0) rspec-expectations (>= 3.0.0) - rspec-mocks (3.8.0) + rspec-mocks (3.9.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.1) + rspec-support (~> 3.9.0) + rspec-rails (3.9.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - sprockets (3.7.2) + rspec-core (~> 3.9.0) + rspec-expectations (~> 3.9.0) + rspec-mocks (~> 3.9.0) + rspec-support (~> 3.9.0) + rspec-support (3.9.4) + ruby3-backward-compatibility (1.5.0) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sqlite3 (1.3.13) - thor (0.20.0) + thor (1.4.0) thread_safe (0.3.6) - tzinfo (1.2.5) + timeout (0.4.3) + tzinfo (1.2.11) thread_safe (~> 0.1) - wwtd (1.3.0) PLATFORMS - ruby + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES appraisal + base64 + bigdecimal modern_searchlogic! - pg (= 0.20) + mutex_m + pg pry - rails (~> 4.2.10) + rails (~> 4.2)! + rake (~> 12.0) + rspec (~> 3.0) rspec-its - rspec-rails - sqlite3 - wwtd + rspec-rails (~> 3.0) + ruby3-backward-compatibility BUNDLED WITH - 1.16.2 + 2.7.1 diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile index cbe301d..09893e6 100644 --- a/gemfiles/rails_5.gemfile +++ b/gemfiles/rails_5.gemfile @@ -2,12 +2,19 @@ source "https://rubygems.org" -gem "rails", "~> 5.2.1" +gem "rake", "~> 13.0" +gem "pg" gem "listen" -gem "sqlite3" -gem "rspec-rails" +gem "rspec", "~> 3.0" +gem "rspec-rails", "~> 5.0" gem "rspec-its" -gem "pg" gem "pry" +gem "ruby3-backward-compatibility" +gem "mutex_m" +gem "bigdecimal" + +source "https://gems.railslts.com" do + gem "rails", "~> 5.2" +end gemspec path: "../" diff --git a/gemfiles/rails_5.gemfile.lock b/gemfiles/rails_5.gemfile.lock index 8219d15..a11afdb 100644 --- a/gemfiles/rails_5.gemfile.lock +++ b/gemfiles/rails_5.gemfile.lock @@ -5,171 +5,235 @@ PATH rails (>= 3.2.14) GEM - remote: https://rubygems.org/ + remote: https://gems.railslts.com/ specs: - actioncable (5.2.1) - actionpack (= 5.2.1) + actioncable (5.2.8.33) + actionpack (= 5.2.8.33) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.1) - actionpack (= 5.2.1) - actionview (= 5.2.1) - activejob (= 5.2.1) + actionmailer (5.2.8.33) + actionpack (= 5.2.8.33) + actionview (= 5.2.8.33) + activejob (= 5.2.8.33) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.1) - actionview (= 5.2.1) - activesupport (= 5.2.1) - rack (~> 2.0) + actionpack (5.2.8.33) + actionview (= 5.2.8.33) + activesupport (= 5.2.8.33) + rack (= 2.2.17.10) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.1) - activesupport (= 5.2.1) + actionview (5.2.8.33) + activesupport (= 5.2.8.33) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.1) - activesupport (= 5.2.1) + activejob (5.2.8.33) + activesupport (= 5.2.8.33) globalid (>= 0.3.6) - activemodel (5.2.1) - activesupport (= 5.2.1) - activerecord (5.2.1) - activemodel (= 5.2.1) - activesupport (= 5.2.1) + activemodel (5.2.8.33) + activesupport (= 5.2.8.33) + activerecord (5.2.8.33) + activemodel (= 5.2.8.33) + activesupport (= 5.2.8.33) arel (>= 9.0) - activestorage (5.2.1) - actionpack (= 5.2.1) - activerecord (= 5.2.1) - marcel (~> 0.3.1) - activesupport (5.2.1) + activestorage (5.2.8.33) + actionpack (= 5.2.8.33) + activerecord (= 5.2.8.33) + marcel (~> 1.0.0) + activesupport (5.2.8.33) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) - tzinfo (~> 1.1) - appraisal (2.2.0) + tzinfo (~> 1.1, >= 1.2.10) + rack (2.2.17.10) + rails (5.2.8.33) + actioncable (= 5.2.8.33) + actionmailer (= 5.2.8.33) + actionpack (= 5.2.8.33) + actionview (= 5.2.8.33) + activejob (= 5.2.8.33) + activemodel (= 5.2.8.33) + activerecord (= 5.2.8.33) + activestorage (= 5.2.8.33) + activesupport (= 5.2.8.33) + bundler (>= 1.3.0) + railties (= 5.2.8.33) + sprockets-rails (>= 2.0.0) + railties (5.2.8.33) + actionpack (= 5.2.8.33) + activesupport (= 5.2.8.33) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + +GEM + remote: https://rubygems.org/ + specs: + appraisal (2.5.0) bundler rake thor (>= 0.14.0) arel (9.0.0) - builder (3.2.3) - coderay (1.1.2) - concurrent-ruby (1.1.5) - crass (1.0.4) - diff-lcs (1.3) - erubi (1.7.1) - ffi (1.9.25) - globalid (0.4.1) - activesupport (>= 4.2.0) - i18n (1.6.0) + base64 (0.3.0) + bigdecimal (3.2.2) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.5) + crass (1.0.6) + date (3.4.1) + diff-lcs (1.6.2) + erubi (1.13.1) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + globalid (1.1.0) + activesupport (>= 5.0) + i18n (1.14.7) concurrent-ruby (~> 1.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) - loofah (2.2.3) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + loofah (2.24.1) crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) + nokogiri (>= 1.12.0) + mail (2.8.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) - method_source (0.9.1) - mimemagic (0.3.2) - mini_mime (1.0.1) - mini_portile2 (2.4.0) - minitest (5.11.3) - nio4r (2.3.1) - nokogiri (1.10.4) - mini_portile2 (~> 2.4.0) - pg (1.1.3) - pry (0.12.0) - coderay (~> 1.1.0) - method_source (~> 0.9.0) - rack (2.0.6) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (5.2.1) - actioncable (= 5.2.1) - actionmailer (= 5.2.1) - actionpack (= 5.2.1) - actionview (= 5.2.1) - activejob (= 5.2.1) - activemodel (= 5.2.1) - activerecord (= 5.2.1) - activestorage (= 5.2.1) - activesupport (= 5.2.1) - bundler (>= 1.3.0) - railties (= 5.2.1) - sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.5) + mutex_m (0.3.0) + net-imap (0.5.9) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.9-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-musl) + racc (~> 1.4) + pg (1.6.1) + pg (1.6.1-aarch64-linux) + pg (1.6.1-aarch64-linux-musl) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-darwin) + pg (1.6.1-x86_64-linux) + pg (1.6.1-x86_64-linux-musl) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + racc (1.8.1) + rack-test (2.2.0) + rack (>= 1.3) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) - railties (5.2.1) - actionpack (= 5.2.1) - activesupport (= 5.2.1) - method_source - rake (>= 0.8.7) - thor (>= 0.19.0, < 2.0) - rake (12.3.1) - rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rspec-core (3.8.0) - rspec-support (~> 3.8.0) - rspec-expectations (3.8.2) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + rake (13.3.0) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.5) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-its (1.2.0) - rspec-core (>= 3.0.0) - rspec-expectations (>= 3.0.0) - rspec-mocks (3.8.0) + rspec-support (~> 3.13.0) + rspec-its (2.0.0) + rspec-core (>= 3.13.0) + rspec-expectations (>= 3.13.0) + rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.8.0) - rspec-rails (3.8.1) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.8.0) - rspec-expectations (~> 3.8.0) - rspec-mocks (~> 3.8.0) - rspec-support (~> 3.8.0) - rspec-support (3.8.0) - ruby_dep (1.5.0) - sprockets (3.7.2) + rspec-support (~> 3.13.0) + rspec-rails (5.1.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.13.5) + ruby3-backward-compatibility (1.5.0) + sprockets (4.2.2) concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) + logger + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.3.13) - thor (0.20.3) + thor (1.4.0) thread_safe (0.3.6) - tzinfo (1.2.5) + timeout (0.4.3) + tzinfo (1.2.11) thread_safe (~> 0.1) - websocket-driver (0.7.0) + websocket-driver (0.8.0) + base64 websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.3) - wwtd (1.3.0) + websocket-extensions (0.1.5) PLATFORMS - ruby + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl DEPENDENCIES appraisal + bigdecimal listen modern_searchlogic! + mutex_m pg pry - rails (~> 5.2.1) + rails (~> 5.2)! + rake (~> 13.0) + rspec (~> 3.0) rspec-its - rspec-rails - sqlite3 - wwtd + rspec-rails (~> 5.0) + ruby3-backward-compatibility BUNDLED WITH - 1.16.2 + 2.7.1 diff --git a/gemfiles/rails_7.gemfile b/gemfiles/rails_7.gemfile new file mode 100644 index 0000000..b551914 --- /dev/null +++ b/gemfiles/rails_7.gemfile @@ -0,0 +1,14 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 7.2" +gem "rake", "~> 13.0" +gem "pg" +gem "listen" +gem "rspec", "~> 3.0" +gem "rspec-rails", "~> 8.0" +gem "rspec-its" +gem "pry" + +gemspec path: "../" diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock new file mode 100644 index 0000000..4574af3 --- /dev/null +++ b/gemfiles/rails_7.gemfile.lock @@ -0,0 +1,282 @@ +PATH + remote: .. + specs: + modern_searchlogic (0.0.1) + rails (>= 3.2.14) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.2.2.2) + actionpack (= 7.2.2.2) + activesupport (= 7.2.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.2.2.2) + actionpack (= 7.2.2.2) + activejob (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) + mail (>= 2.8.0) + actionmailer (7.2.2.2) + actionpack (= 7.2.2.2) + actionview (= 7.2.2.2) + activejob (= 7.2.2.2) + activesupport (= 7.2.2.2) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.2.2) + actionview (= 7.2.2.2) + activesupport (= 7.2.2.2) + 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.2.2) + actionpack (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.2.2) + activesupport (= 7.2.2.2) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.2.2) + activesupport (= 7.2.2.2) + globalid (>= 0.3.6) + activemodel (7.2.2.2) + activesupport (= 7.2.2.2) + activerecord (7.2.2.2) + activemodel (= 7.2.2.2) + activesupport (= 7.2.2.2) + timeout (>= 0.4.0) + activestorage (7.2.2.2) + actionpack (= 7.2.2.2) + activejob (= 7.2.2.2) + activerecord (= 7.2.2.2) + activesupport (= 7.2.2.2) + marcel (~> 1.0) + activesupport (7.2.2.2) + base64 + benchmark (>= 0.3) + 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) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + base64 (0.3.0) + benchmark (0.4.1) + bigdecimal (3.2.2) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.5) + connection_pool (2.5.3) + crass (1.0.6) + date (3.4.1) + diff-lcs (1.6.2) + drb (2.2.3) + erb (5.0.2) + erubi (1.13.1) + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-arm64-darwin) + ffi (1.17.2-x86_64-darwin) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + io-console (0.8.1) + irb (1.15.2) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + listen (3.9.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + logger (1.7.0) + loofah (2.24.1) + 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) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.5) + net-imap (0.5.9) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.1) + net-protocol + nio4r (2.7.4) + nokogiri (1.18.9-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.9-arm64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.9-x86_64-linux-musl) + racc (~> 1.4) + pg (1.6.1) + pg (1.6.1-aarch64-linux) + pg (1.6.1-aarch64-linux-musl) + pg (1.6.1-arm64-darwin) + pg (1.6.1-x86_64-darwin) + pg (1.6.1-x86_64-linux) + pg (1.6.1-x86_64-linux-musl) + pp (0.6.2) + prettyprint + prettyprint (0.2.0) + pry (0.15.2) + coderay (~> 1.1) + method_source (~> 1.0) + psych (5.2.6) + date + stringio + racc (1.8.1) + rack (3.1.16) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.2.1) + rack (>= 3) + rails (7.2.2.2) + actioncable (= 7.2.2.2) + actionmailbox (= 7.2.2.2) + actionmailer (= 7.2.2.2) + actionpack (= 7.2.2.2) + actiontext (= 7.2.2.2) + actionview (= 7.2.2.2) + activejob (= 7.2.2.2) + activemodel (= 7.2.2.2) + activerecord (= 7.2.2.2) + activestorage (= 7.2.2.2) + activesupport (= 7.2.2.2) + bundler (>= 1.15.0) + railties (= 7.2.2.2) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (7.2.2.2) + actionpack (= 7.2.2.2) + activesupport (= 7.2.2.2) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rake (13.3.0) + rb-fsevent (0.11.2) + rb-inotify (0.11.1) + ffi (~> 1.0) + rdoc (6.14.2) + erb + psych (>= 4.0.0) + reline (0.6.2) + io-console (~> 0.5) + rspec (3.13.1) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) + rspec-core (3.13.5) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-its (2.0.0) + rspec-core (>= 3.13.0) + rspec-expectations (>= 3.13.0) + rspec-mocks (3.13.5) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (8.0.2) + actionpack (>= 7.2) + activesupport (>= 7.2) + railties (>= 7.2) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.5) + securerandom (0.4.1) + stringio (3.1.7) + thor (1.4.0) + timeout (0.4.3) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + useragent (0.16.11) + websocket-driver (0.8.0) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.7.3) + +PLATFORMS + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + arm64-darwin + x86_64-darwin + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + appraisal + listen + modern_searchlogic! + pg + pry + rails (~> 7.2) + rake (~> 13.0) + rspec (~> 3.0) + rspec-its + rspec-rails (~> 8.0) + +BUNDLED WITH + 2.7.1 diff --git a/lib/modern_searchlogic/column_conditions.rb b/lib/modern_searchlogic/column_conditions.rb index c08d9ff..b7413a7 100644 --- a/lib/modern_searchlogic/column_conditions.rb +++ b/lib/modern_searchlogic/column_conditions.rb @@ -6,7 +6,7 @@ def respond_to_missing?(method, *) end def valid_searchlogic_scope?(method) - return false if method =~ /^define_method_/ + return false if connection.tables.empty? || method =~ /^define_method_/ || abstract_class? searchlogic_scope_dynamically_defined?(method) || !!searchlogic_column_condition_method_block(method.to_s) || @@ -191,6 +191,7 @@ def column_names_regexp end def method_missing(method, *args, &block) + return super if connection.tables.empty? || abstract_class? return super unless dynamically_define_searchlogic_method(method) __send__(method, *args, &block) diff --git a/modern_searchlogic.gemspec b/modern_searchlogic.gemspec index ef20aeb..3905a97 100644 --- a/modern_searchlogic.gemspec +++ b/modern_searchlogic.gemspec @@ -19,5 +19,5 @@ Gem::Specification.new do |s| s.add_dependency "rails", ">= 3.2.14" s.add_development_dependency 'appraisal' - s.add_development_dependency 'wwtd' + s.add_development_dependency 'rake' end diff --git a/spec/app_rails3/Rakefile b/spec/app_rails3/Rakefile index 367788e..8f5d2ba 100644 --- a/spec/app_rails3/Rakefile +++ b/spec/app_rails3/Rakefile @@ -2,6 +2,12 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. +Rake::Application.class_eval do + def last_comment + nil + end +end + require File.expand_path('../config/application', __FILE__) App::Application.load_tasks diff --git a/spec/app_rails3/config/application.rb b/spec/app_rails3/config/application.rb index 4a6c74b..0f71272 100644 --- a/spec/app_rails3/config/application.rb +++ b/spec/app_rails3/config/application.rb @@ -3,8 +3,8 @@ # Pick the frameworks you want: require "active_record/railtie" require "action_controller/railtie" -require "action_mailer/railtie" -require "active_resource/railtie" +# require "action_mailer/railtie" +# require "active_resource/railtie" # require "sprockets/railtie" # require "rails/test_unit/railtie" diff --git a/spec/app_rails3/config/boot.rb b/spec/app_rails3/config/boot.rb index 4489e58..f2830ae 100644 --- a/spec/app_rails3/config/boot.rb +++ b/spec/app_rails3/config/boot.rb @@ -3,4 +3,4 @@ # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) diff --git a/spec/app_rails3/config/environments/development.rb b/spec/app_rails3/config/environments/development.rb index 65d9cb0..77989a2 100644 --- a/spec/app_rails3/config/environments/development.rb +++ b/spec/app_rails3/config/environments/development.rb @@ -14,7 +14,7 @@ config.action_controller.perform_caching = false # Don't care if the mailer can't send - config.action_mailer.raise_delivery_errors = false + # config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger config.active_support.deprecation = :log diff --git a/spec/app_rails3/config/environments/test.rb b/spec/app_rails3/config/environments/test.rb index 36e886d..9e790af 100644 --- a/spec/app_rails3/config/environments/test.rb +++ b/spec/app_rails3/config/environments/test.rb @@ -27,7 +27,7 @@ # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test + # config.action_mailer.delivery_method = :test # Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict diff --git a/spec/app_rails3/db b/spec/app_rails3/db deleted file mode 120000 index a21da8a..0000000 --- a/spec/app_rails3/db +++ /dev/null @@ -1 +0,0 @@ -../shared/db \ No newline at end of file diff --git a/spec/app_rails3/db/migrate b/spec/app_rails3/db/migrate new file mode 120000 index 0000000..256665d --- /dev/null +++ b/spec/app_rails3/db/migrate @@ -0,0 +1 @@ +../../shared/db/migrate \ No newline at end of file diff --git a/spec/app_rails3/db/schema.rb b/spec/app_rails3/db/schema.rb new file mode 100644 index 0000000..06b247c --- /dev/null +++ b/spec/app_rails3/db/schema.rb @@ -0,0 +1,51 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended to check this file into your version control system. + +ActiveRecord::Schema.define(:version => 20190812194128) do + + create_table "comments", :force => true do |t| + t.text "body" + t.integer "post_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "posts", :force => true do |t| + t.integer "user_id" + t.string "title" + t.text "body" + t.datetime "published_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "users", :force => true do |t| + t.string "username" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "age", :default => 0, :null => false + t.string "email" + t.boolean "active" + t.integer "backup_user_id" + end + + create_table "votes", :force => true do |t| + t.integer "voteable_id", :null => false + t.string "voteable_type", :null => false + t.integer "vote", :null => false + t.integer "voter_id", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + +end diff --git a/spec/app_rails4/config/application.rb b/spec/app_rails4/config/application.rb index f2d5fa9..4b4c77b 100644 --- a/spec/app_rails4/config/application.rb +++ b/spec/app_rails4/config/application.rb @@ -3,9 +3,9 @@ # Pick the frameworks you want: require "active_record/railtie" require "action_controller/railtie" -require "action_mailer/railtie" +# require "action_mailer/railtie" require "action_view/railtie" -require "sprockets/railtie" +# require "sprockets/railtie" # require "rails/test_unit/railtie" Bundler.require(*Rails.groups) diff --git a/spec/app_rails4/config/environments/development.rb b/spec/app_rails4/config/environments/development.rb index b55e214..f32364e 100644 --- a/spec/app_rails4/config/environments/development.rb +++ b/spec/app_rails4/config/environments/development.rb @@ -14,7 +14,7 @@ config.action_controller.perform_caching = false # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false + # config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -25,16 +25,16 @@ # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. - config.assets.debug = true + # config.assets.debug = true # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. - config.assets.digest = true + # config.assets.digest = true # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # config.assets.raise_runtime_errors = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true diff --git a/spec/app_rails4/config/environments/production.rb b/spec/app_rails4/config/environments/production.rb index 5c1b32e..218ab2d 100644 --- a/spec/app_rails4/config/environments/production.rb +++ b/spec/app_rails4/config/environments/production.rb @@ -25,15 +25,15 @@ config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + # config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # config.assets.compile = false # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. - config.assets.digest = true + # config.assets.digest = true # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb diff --git a/spec/app_rails4/config/environments/test.rb b/spec/app_rails4/config/environments/test.rb index 1c19f08..5b095c6 100644 --- a/spec/app_rails4/config/environments/test.rb +++ b/spec/app_rails4/config/environments/test.rb @@ -29,7 +29,7 @@ # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test + # config.action_mailer.delivery_method = :test # Randomize the order test cases are executed. config.active_support.test_order = :random @@ -39,4 +39,6 @@ # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + config.active_record.dump_schema_after_migration = true end diff --git a/spec/app_rails4/config/initializers/assets.rb b/spec/app_rails4/config/initializers/assets.rb deleted file mode 100644 index 01ef3e6..0000000 --- a/spec/app_rails4/config/initializers/assets.rb +++ /dev/null @@ -1,11 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path -# Rails.application.config.assets.paths << Emoji.images_path - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) diff --git a/spec/app_rails4/db b/spec/app_rails4/db deleted file mode 120000 index a21da8a..0000000 --- a/spec/app_rails4/db +++ /dev/null @@ -1 +0,0 @@ -../shared/db \ No newline at end of file diff --git a/spec/app_rails4/db/migrate b/spec/app_rails4/db/migrate new file mode 120000 index 0000000..256665d --- /dev/null +++ b/spec/app_rails4/db/migrate @@ -0,0 +1 @@ +../../shared/db/migrate \ No newline at end of file diff --git a/spec/app_rails4/db/schema.rb b/spec/app_rails4/db/schema.rb new file mode 100644 index 0000000..715ffe8 --- /dev/null +++ b/spec/app_rails4/db/schema.rb @@ -0,0 +1,54 @@ +# encoding: UTF-8 +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# Note that this schema.rb definition is the authoritative source for your +# database schema. If you need to create the application database on another +# system, you should be using db:schema:load, not running all the migrations +# from scratch. The latter is a flawed and unsustainable approach (the more migrations +# you'll amass, the slower it'll run and the greater likelihood for issues). +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema.define(version: 20190812194128) do + + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "comments", force: :cascade do |t| + t.text "body" + t.integer "post_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "posts", force: :cascade do |t| + t.integer "user_id" + t.string "title" + t.text "body" + t.datetime "published_at" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "users", force: :cascade do |t| + t.string "username" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "age", default: 0, null: false + t.string "email" + t.boolean "active" + t.integer "backup_user_id" + end + + create_table "votes", force: :cascade do |t| + t.integer "voteable_id", null: false + t.string "voteable_type", null: false + t.integer "vote", null: false + t.integer "voter_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + +end diff --git a/spec/app_rails5/.ruby-version b/spec/app_rails5/.ruby-version deleted file mode 100644 index 51bd855..0000000 --- a/spec/app_rails5/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -2.3.7 \ No newline at end of file diff --git a/spec/app_rails5/app/assets/config/manifest.js b/spec/app_rails5/app/assets/config/manifest.js deleted file mode 100644 index b16e53d..0000000 --- a/spec/app_rails5/app/assets/config/manifest.js +++ /dev/null @@ -1,3 +0,0 @@ -//= link_tree ../images -//= link_directory ../javascripts .js -//= link_directory ../stylesheets .css diff --git a/spec/app_rails5/app/assets/javascripts/application.js b/spec/app_rails5/app/assets/javascripts/application.js deleted file mode 100644 index 82e6f0f..0000000 --- a/spec/app_rails5/app/assets/javascripts/application.js +++ /dev/null @@ -1,16 +0,0 @@ -// This is a manifest file that'll be compiled into application.js, which will include all the files -// listed below. -// -// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's -// vendor/assets/javascripts directory can be referenced here using a relative path. -// -// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the -// compiled file. JavaScript code in this file should be added after the last require_* statement. -// -// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details -// about supported directives. -// -//= require rails-ujs -//= require activestorage -//= require turbolinks -//= require_tree . diff --git a/spec/app_rails5/app/assets/javascripts/cable.js b/spec/app_rails5/app/assets/javascripts/cable.js deleted file mode 100644 index 739aa5f..0000000 --- a/spec/app_rails5/app/assets/javascripts/cable.js +++ /dev/null @@ -1,13 +0,0 @@ -// Action Cable provides the framework to deal with WebSockets in Rails. -// You can generate new channels where WebSocket features live using the `rails generate channel` command. -// -//= require action_cable -//= require_self -//= require_tree ./channels - -(function() { - this.App || (this.App = {}); - - App.cable = ActionCable.createConsumer(); - -}).call(this); diff --git a/spec/app_rails5/app/assets/javascripts/channels/.keep b/spec/app_rails5/app/assets/javascripts/channels/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/spec/app_rails5/app/assets/stylesheets/application.css b/spec/app_rails5/app/assets/stylesheets/application.css deleted file mode 100644 index d05ea0f..0000000 --- a/spec/app_rails5/app/assets/stylesheets/application.css +++ /dev/null @@ -1,15 +0,0 @@ -/* - * This is a manifest file that'll be compiled into application.css, which will include all the files - * listed below. - * - * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's - * vendor/assets/stylesheets directory can be referenced here using a relative path. - * - * You're free to add application-wide styles to this file and they'll appear at the bottom of the - * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS - * files in this directory. Styles in this file should be added after the last require_* statement. - * It is generally better to create a new file per style scope. - * - *= require_tree . - *= require_self - */ diff --git a/spec/app_rails5/app/channels/application_cable/channel.rb b/spec/app_rails5/app/channels/application_cable/channel.rb deleted file mode 100644 index d672697..0000000 --- a/spec/app_rails5/app/channels/application_cable/channel.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Channel < ActionCable::Channel::Base - end -end diff --git a/spec/app_rails5/app/channels/application_cable/connection.rb b/spec/app_rails5/app/channels/application_cable/connection.rb deleted file mode 100644 index 0ff5442..0000000 --- a/spec/app_rails5/app/channels/application_cable/connection.rb +++ /dev/null @@ -1,4 +0,0 @@ -module ApplicationCable - class Connection < ActionCable::Connection::Base - end -end diff --git a/spec/app_rails5/app/jobs/application_job.rb b/spec/app_rails5/app/jobs/application_job.rb deleted file mode 100644 index a009ace..0000000 --- a/spec/app_rails5/app/jobs/application_job.rb +++ /dev/null @@ -1,2 +0,0 @@ -class ApplicationJob < ActiveJob::Base -end diff --git a/spec/app_rails5/app/mailers/application_mailer.rb b/spec/app_rails5/app/mailers/application_mailer.rb deleted file mode 100644 index 286b223..0000000 --- a/spec/app_rails5/app/mailers/application_mailer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class ApplicationMailer < ActionMailer::Base - default from: 'from@example.com' - layout 'mailer' -end diff --git a/spec/app_rails5/app/views/layouts/application.html.erb b/spec/app_rails5/app/views/layouts/application.html.erb index 401ad8b..b8e6592 100644 --- a/spec/app_rails5/app/views/layouts/application.html.erb +++ b/spec/app_rails5/app/views/layouts/application.html.erb @@ -4,9 +4,6 @@ AppRails5 <%= csrf_meta_tags %> <%= csp_meta_tag %> - - <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> - <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> diff --git a/spec/app_rails5/app/views/layouts/mailer.html.erb b/spec/app_rails5/app/views/layouts/mailer.html.erb deleted file mode 100644 index cbd34d2..0000000 --- a/spec/app_rails5/app/views/layouts/mailer.html.erb +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - <%= yield %> - - diff --git a/spec/app_rails5/app/views/layouts/mailer.text.erb b/spec/app_rails5/app/views/layouts/mailer.text.erb deleted file mode 100644 index 37f0bdd..0000000 --- a/spec/app_rails5/app/views/layouts/mailer.text.erb +++ /dev/null @@ -1 +0,0 @@ -<%= yield %> diff --git a/spec/app_rails5/bin/bundle b/spec/app_rails5/bin/bundle deleted file mode 100755 index f19acf5..0000000 --- a/spec/app_rails5/bin/bundle +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env ruby -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -load Gem.bin_path('bundler', 'bundle') diff --git a/spec/app_rails5/bin/rails b/spec/app_rails5/bin/rails index 5badb2f..0739660 100755 --- a/spec/app_rails5/bin/rails +++ b/spec/app_rails5/bin/rails @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/spec/app_rails5/bin/rake b/spec/app_rails5/bin/rake index d87d5f5..1724048 100755 --- a/spec/app_rails5/bin/rake +++ b/spec/app_rails5/bin/rake @@ -1,9 +1,4 @@ #!/usr/bin/env ruby -begin - load File.expand_path('../spring', __FILE__) -rescue LoadError => e - raise unless e.message.include?('spring') -end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/spec/app_rails5/bin/setup b/spec/app_rails5/bin/setup deleted file mode 100755 index 94fd4d7..0000000 --- a/spec/app_rails5/bin/setup +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' -include FileUtils - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -chdir APP_ROOT do - # This script is a starting point to setup your application. - # Add necessary setup steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - - # puts "\n== Copying sample files ==" - # unless File.exist?('config/database.yml') - # cp 'config/database.yml.sample', 'config/database.yml' - # end - - puts "\n== Preparing database ==" - system! 'bin/rails db:setup' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/spec/app_rails5/bin/spring b/spec/app_rails5/bin/spring deleted file mode 100755 index fb2ec2e..0000000 --- a/spec/app_rails5/bin/spring +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env ruby - -# This file loads spring without using Bundler, in order to be fast. -# It gets overwritten when you run the `spring binstub` command. - -unless defined?(Spring) - require 'rubygems' - require 'bundler' - - lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) - spring = lockfile.specs.detect { |spec| spec.name == "spring" } - if spring - Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem 'spring', spring.version - require 'spring/binstub' - end -end diff --git a/spec/app_rails5/bin/update b/spec/app_rails5/bin/update deleted file mode 100755 index 58bfaed..0000000 --- a/spec/app_rails5/bin/update +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env ruby -require 'fileutils' -include FileUtils - -# path to your application root. -APP_ROOT = File.expand_path('..', __dir__) - -def system!(*args) - system(*args) || abort("\n== Command #{args} failed ==") -end - -chdir APP_ROOT do - # This script is a way to update your development environment automatically. - # Add necessary update steps to this file. - - puts '== Installing dependencies ==' - system! 'gem install bundler --conservative' - system('bundle check') || system!('bundle install') - - # Install JavaScript dependencies if using Yarn - # system('bin/yarn') - - puts "\n== Updating database ==" - system! 'bin/rails db:migrate' - - puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' - - puts "\n== Restarting application server ==" - system! 'bin/rails restart' -end diff --git a/spec/app_rails5/bin/yarn b/spec/app_rails5/bin/yarn deleted file mode 100755 index 460dd56..0000000 --- a/spec/app_rails5/bin/yarn +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env ruby -APP_ROOT = File.expand_path('..', __dir__) -Dir.chdir(APP_ROOT) do - begin - exec "yarnpkg", *ARGV - rescue Errno::ENOENT - $stderr.puts "Yarn executable was not detected in the system." - $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" - exit 1 - end -end diff --git a/spec/app_rails5/config/application.rb b/spec/app_rails5/config/application.rb index c7de48f..2b17615 100644 --- a/spec/app_rails5/config/application.rb +++ b/spec/app_rails5/config/application.rb @@ -1,6 +1,8 @@ require_relative 'boot' -require 'rails/all' +require 'active_record/railtie' +require 'action_controller/railtie' +require 'action_view/railtie' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. diff --git a/spec/app_rails5/config/cable.yml b/spec/app_rails5/config/cable.yml deleted file mode 100644 index d4871b6..0000000 --- a/spec/app_rails5/config/cable.yml +++ /dev/null @@ -1,10 +0,0 @@ -development: - adapter: async - -test: - adapter: async - -production: - adapter: redis - url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> - channel_prefix: app_rails5_production diff --git a/spec/app_rails5/config/environments/development.rb b/spec/app_rails5/config/environments/development.rb index 1311e3e..e9b9413 100644 --- a/spec/app_rails5/config/environments/development.rb +++ b/spec/app_rails5/config/environments/development.rb @@ -28,12 +28,12 @@ end # Store uploaded files on the local file system (see config/storage.yml for options) - config.active_storage.service = :local + # config.active_storage.service = :local # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false + # config.action_mailer.raise_delivery_errors = false - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log @@ -47,10 +47,10 @@ # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. - config.assets.debug = true + # config.assets.debug = true # Suppress logger output for asset requests. - config.assets.quiet = true + # config.assets.quiet = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true diff --git a/spec/app_rails5/config/environments/production.rb b/spec/app_rails5/config/environments/production.rb index d3b2975..62ad25b 100644 --- a/spec/app_rails5/config/environments/production.rb +++ b/spec/app_rails5/config/environments/production.rb @@ -23,11 +23,11 @@ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. - config.assets.js_compressor = :uglifier + # config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. - config.assets.compile = false + # config.assets.compile = false # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb @@ -39,7 +39,7 @@ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options) - config.active_storage.service = :local + # config.active_storage.service = :local # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil @@ -63,7 +63,7 @@ # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "app_rails5_#{Rails.env}" - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. diff --git a/spec/app_rails5/config/environments/test.rb b/spec/app_rails5/config/environments/test.rb index 0a38fd3..9ce134e 100644 --- a/spec/app_rails5/config/environments/test.rb +++ b/spec/app_rails5/config/environments/test.rb @@ -29,18 +29,20 @@ config.action_controller.allow_forgery_protection = false # Store uploaded files on the local file system in a temporary directory - config.active_storage.service = :test + # config.active_storage.service = :test - config.action_mailer.perform_caching = false + # config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. - config.action_mailer.delivery_method = :test + # config.action_mailer.delivery_method = :test # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + config.active_record.dump_schema_after_migration = true end diff --git a/spec/app_rails5/config/initializers/assets.rb b/spec/app_rails5/config/initializers/assets.rb deleted file mode 100644 index 4b828e8..0000000 --- a/spec/app_rails5/config/initializers/assets.rb +++ /dev/null @@ -1,14 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# Add additional assets to the asset load path. -# Rails.application.config.assets.paths << Emoji.images_path -# Add Yarn node_modules folder to the asset load path. -Rails.application.config.assets.paths << Rails.root.join('node_modules') - -# Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in the app/assets -# folder are already added. -# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/spec/app_rails5/config/spring.rb b/spec/app_rails5/config/spring.rb deleted file mode 100644 index 9fa7863..0000000 --- a/spec/app_rails5/config/spring.rb +++ /dev/null @@ -1,6 +0,0 @@ -%w[ - .ruby-version - .rbenv-vars - tmp/restart.txt - tmp/caching-dev.txt -].each { |path| Spring.watch(path) } diff --git a/spec/app_rails5/config/storage.yml b/spec/app_rails5/config/storage.yml deleted file mode 100644 index d32f76e..0000000 --- a/spec/app_rails5/config/storage.yml +++ /dev/null @@ -1,34 +0,0 @@ -test: - service: Disk - root: <%= Rails.root.join("tmp/storage") %> - -local: - service: Disk - root: <%= Rails.root.join("storage") %> - -# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key) -# amazon: -# service: S3 -# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %> -# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %> -# region: us-east-1 -# bucket: your_own_bucket - -# Remember not to checkin your GCS keyfile to a repository -# google: -# service: GCS -# project: your_project -# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %> -# bucket: your_own_bucket - -# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key) -# microsoft: -# service: AzureStorage -# storage_account_name: your_account_name -# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %> -# container: your_container_name - -# mirror: -# service: Mirror -# primary: local -# mirrors: [ amazon, google, microsoft ] diff --git a/spec/app_rails5/db b/spec/app_rails5/db deleted file mode 120000 index 053d3db..0000000 --- a/spec/app_rails5/db +++ /dev/null @@ -1 +0,0 @@ -../shared/db/ \ No newline at end of file diff --git a/spec/app_rails5/db/migrate b/spec/app_rails5/db/migrate new file mode 120000 index 0000000..256665d --- /dev/null +++ b/spec/app_rails5/db/migrate @@ -0,0 +1 @@ +../../shared/db/migrate \ No newline at end of file diff --git a/spec/shared/db/schema.rb b/spec/app_rails5/db/schema.rb similarity index 65% rename from spec/shared/db/schema.rb rename to spec/app_rails5/db/schema.rb index a3af979..3895c9c 100644 --- a/spec/shared/db/schema.rb +++ b/spec/app_rails5/db/schema.rb @@ -10,44 +10,48 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(:version => 20190812194128) do +ActiveRecord::Schema.define(version: 2019_08_12_194128) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" - create_table "comments", id: :serial, force: :cascade do |t| + create_table "comments", force: :cascade do |t| t.text "body" - t.integer "post_id", null: false + t.bigint "post_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["post_id"], name: "index_comments_on_post_id" end - create_table "posts", id: :serial, force: :cascade do |t| - t.integer "user_id" - t.string "title", limit: 255 + create_table "posts", force: :cascade do |t| + t.bigint "user_id" + t.string "title" t.text "body" t.datetime "published_at" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_posts_on_user_id" end - create_table "users", id: :serial, force: :cascade do |t| - t.string "username", limit: 255 + create_table "users", force: :cascade do |t| + t.string "username" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.integer "age", default: 0, null: false - t.string "email", limit: 255 + t.string "email" t.boolean "active" - t.integer "backup_user_id" + t.integer "backup_user_id" end - create_table "votes", id: :serial, force: :cascade do |t| - t.integer "voteable_id", null: false + create_table "votes", force: :cascade do |t| t.string "voteable_type", null: false + t.bigint "voteable_id", null: false t.integer "vote", null: false - t.integer "voter_id", null: false + t.bigint "voter_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["voteable_type", "voteable_id"], name: "index_votes_on_voteable_type_and_voteable_id" + t.index ["voter_id"], name: "index_votes_on_voter_id" end end diff --git a/spec/app_rails7/.gitignore b/spec/app_rails7/.gitignore new file mode 100644 index 0000000..f92525c --- /dev/null +++ b/spec/app_rails7/.gitignore @@ -0,0 +1,34 @@ +# See https://help.github.com/articles/ignoring-files for more about ignoring files. +# +# Temporary files generated by your text editor or operating system +# belong in git's global ignore instead: +# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore` + +# Ignore bundler config. +/.bundle + +# Ignore all environment files. +/.env* + +# 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 storage (uploaded files in development and any SQLite databases). +/storage/* +!/storage/.keep +/tmp/storage/* +!/tmp/storage/ +!/tmp/storage/.keep + +/public/assets + +# Ignore master key for decrypting credentials and more. +/config/master.key diff --git a/spec/app_rails7/README.md b/spec/app_rails7/README.md new file mode 100644 index 0000000..7db80e4 --- /dev/null +++ b/spec/app_rails7/README.md @@ -0,0 +1,24 @@ +# README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... diff --git a/spec/app_rails7/Rakefile b/spec/app_rails7/Rakefile new file mode 100644 index 0000000..9a5ea73 --- /dev/null +++ b/spec/app_rails7/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative "config/application" + +Rails.application.load_tasks diff --git a/spec/app_rails7/app/models b/spec/app_rails7/app/models new file mode 120000 index 0000000..d896075 --- /dev/null +++ b/spec/app_rails7/app/models @@ -0,0 +1 @@ +../../shared/models \ No newline at end of file diff --git a/spec/app_rails7/bin/rails b/spec/app_rails7/bin/rails new file mode 100755 index 0000000..efc0377 --- /dev/null +++ b/spec/app_rails7/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/spec/app_rails7/bin/rake b/spec/app_rails7/bin/rake new file mode 100755 index 0000000..4fbf10b --- /dev/null +++ b/spec/app_rails7/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "rake" +Rake.application.run diff --git a/spec/app_rails7/config.ru b/spec/app_rails7/config.ru new file mode 100644 index 0000000..4a3c09a --- /dev/null +++ b/spec/app_rails7/config.ru @@ -0,0 +1,6 @@ +# This file is used by Rack-based servers to start the application. + +require_relative "config/environment" + +run Rails.application +Rails.application.load_server diff --git a/spec/app_rails7/config/application.rb b/spec/app_rails7/config/application.rb new file mode 100644 index 0000000..e5fa4a9 --- /dev/null +++ b/spec/app_rails7/config/application.rb @@ -0,0 +1,21 @@ +require_relative 'boot' + +require 'active_record/railtie' +require 'action_controller/railtie' +require 'action_view/railtie' + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module AppRails5 + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 7.2 + + # Settings in config/environments/* take precedence over those specified here. + # Application configuration can go into files in config/initializers + # -- all .rb files in that directory are automatically loaded after loading + # the framework and any gems in your application. + end +end diff --git a/spec/app_rails7/config/boot.rb b/spec/app_rails7/config/boot.rb new file mode 100644 index 0000000..2820116 --- /dev/null +++ b/spec/app_rails7/config/boot.rb @@ -0,0 +1,3 @@ +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/spec/app_rails7/config/credentials.yml.enc b/spec/app_rails7/config/credentials.yml.enc new file mode 100644 index 0000000..9787c18 --- /dev/null +++ b/spec/app_rails7/config/credentials.yml.enc @@ -0,0 +1 @@ +t+YX+ziBFsS/WQmxURYRZk9viuqFXhEHG22E2MRK/ew0YO7n3/dxRzKECCFlbESk/pqztA5qvAt1jbYBP33/yq12GsWfDTSz0/W0RpEDOrZYng/HYkfwtSN8Ndx6BmYBYXVrefI2znI6Ir1Uh72e4HMpdbqdz0ne3iCBV7ViohEp7M3CP6YIIeoKhzeQZzhP9faqecuR5OLNTVfiZfAjxIPOYKIp3eMDN4+qeNRhek01qVQ2O1T4mDyBuiYB4ZmgWnSWGEJsqrIhl1JrWIXqC83+LjQlnll5tTkt1+Sib/iLXd7W6AXJ8kcFrwPKA2eD/zZjxC5sqjT0leDU8S3n1d4WvI8uIqenmBnXkDUavV6T++o9mqnrl+LduhcqICftA9Dh2nYHJgO9x9mfwK01QqxVAaTWBRli1IUENJw75a5w/vjBw6B/5l2cmeYks7KsmN2BVqjdEeCDOKi8tn/aSpz5VR8X9sd3sI+2rlCF8z9PZ/9r6z0L1YvA--7I3v+eBl8ODJx1sp--Q/o4uxw8UZkB29jlVOrSmA== \ No newline at end of file diff --git a/spec/app_rails7/config/database.yml b/spec/app_rails7/config/database.yml new file mode 120000 index 0000000..d795114 --- /dev/null +++ b/spec/app_rails7/config/database.yml @@ -0,0 +1 @@ +../../shared/config/database.yml \ No newline at end of file diff --git a/spec/app_rails7/config/environment.rb b/spec/app_rails7/config/environment.rb new file mode 100644 index 0000000..cac5315 --- /dev/null +++ b/spec/app_rails7/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/spec/app_rails7/config/environments/development.rb b/spec/app_rails7/config/environments/development.rb new file mode 100644 index 0000000..26af144 --- /dev/null +++ b/spec/app_rails7/config/environments/development.rb @@ -0,0 +1,60 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Make code changes take effect immediately without server restart. + config.enable_reloading = true + + # Do not eager load code on boot. + config.eager_load = false + + # Show full error reports. + config.consider_all_requests_local = true + + # Enable server timing. + config.server_timing = true + + # Enable/disable Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller caching. + if Rails.root.join("tmp/caching-dev.txt").exist? + config.action_controller.perform_caching = true + config.action_controller.enable_fragment_cache_logging = true + config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } + else + config.action_controller.perform_caching = false + end + + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store + + # Store uploaded files on the local file system (see config/storage.yml for options). + # config.active_storage.service = :local + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # Raise an error on page load if there are pending migrations. + config.active_record.migration_error = :page_load + + # Highlight code that triggered database queries in logs. + config.active_record.verbose_query_logs = true + + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true + + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`. + # config.generators.apply_rubocop_autocorrect_after_generate! +end diff --git a/spec/app_rails7/config/environments/production.rb b/spec/app_rails7/config/environments/production.rb new file mode 100644 index 0000000..8b00d47 --- /dev/null +++ b/spec/app_rails7/config/environments/production.rb @@ -0,0 +1,73 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Code is not reloaded between requests. + config.enable_reloading = false + + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks). + config.eager_load = true + + # Full error reports are disabled. + config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true + + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # Store uploaded files on the local file system (see config/storage.yml for options). + # config.active_storage.service = :local + + # Assume all access to the app is happening through a SSL-terminating reverse proxy. + config.assume_ssl = true + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + config.force_ssl = true + + # Skip http-to-https redirect for the default health check endpoint. + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + + # Log to STDOUT with the current request id as a default log tag. + config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) + + # Change to "debug" to log everything (including potentially personally-identifiable information!) + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. + # config.cache_store = :mem_cache_store + + # Replace the default in-process and non-durable queuing backend for Active Job. + # config.active_job.queue_adapter = :resque + + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to + # the I18n.default_locale when a translation cannot be found). + config.i18n.fallbacks = true + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false + + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + + # Enable DNS rebinding protection and other `Host` header attacks. + # config.hosts = [ + # "example.com", # Allow requests from example.com + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com` + # ] + # + # Skip DNS rebinding protection for the default health check endpoint. + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } } +end diff --git a/spec/app_rails7/config/environments/test.rb b/spec/app_rails7/config/environments/test.rb new file mode 100644 index 0000000..e877c65 --- /dev/null +++ b/spec/app_rails7/config/environments/test.rb @@ -0,0 +1,47 @@ +# The test environment is used exclusively to run your application's +# test suite. You never need to work with it otherwise. Remember that +# your test database is "scratch space" for the test suite and is wiped +# and recreated between test runs. Don't rely on the data there! + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # While tests run files are not watched, reloading is not necessary. + config.enable_reloading = false + + # Eager loading loads your entire application. When running a single test locally, + # this is usually not necessary, and can slow down your test suite. However, it's + # recommended that you enable it in continuous integration systems to ensure eager + # loading is working properly before deploying your code. + config.eager_load = ENV["CI"].present? + + # Configure public file server for tests with cache-control for performance. + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" } + + # Show full error reports. + config.consider_all_requests_local = true + config.cache_store = :null_store + + # Render exception templates for rescuable exceptions and raise for other exceptions. + config.action_dispatch.show_exceptions = :rescuable + + # Disable request forgery protection in test environment. + config.action_controller.allow_forgery_protection = false + + # Store uploaded files on the local file system in a temporary directory. + # config.active_storage.service = :test + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # Raises error for missing translations. + # config.i18n.raise_on_missing_translations = true + + # Annotate rendered view with file names. + # config.action_view.annotate_rendered_view_with_filenames = true + + # Raise error when a before_action's only/except options reference missing actions. + config.action_controller.raise_on_missing_callback_actions = true + + config.active_record.dump_schema_after_migration = true +end diff --git a/spec/app_rails7/config/initializers/filter_parameter_logging.rb b/spec/app_rails7/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..c0b717f --- /dev/null +++ b/spec/app_rails7/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. +# Use this to limit dissemination of sensitive information. +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. +Rails.application.config.filter_parameters += [ + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc +] diff --git a/spec/app_rails7/config/locales/en.yml b/spec/app_rails7/config/locales/en.yml new file mode 100644 index 0000000..6c349ae --- /dev/null +++ b/spec/app_rails7/config/locales/en.yml @@ -0,0 +1,31 @@ +# Files in the config/locales directory are used for internationalization and +# are automatically loaded by Rails. If you want to use locales other than +# English, add the necessary files in this directory. +# +# To use the locales, use `I18n.t`: +# +# I18n.t "hello" +# +# In views, this is aliased to just `t`: +# +# <%= t("hello") %> +# +# To use a different locale, set it with `I18n.locale`: +# +# I18n.locale = :es +# +# This would use the information in config/locales/es.yml. +# +# To learn more about the API, please read the Rails Internationalization guide +# at https://guides.rubyonrails.org/i18n.html. +# +# Be aware that YAML interprets the following case-insensitive strings as +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings +# must be quoted to be interpreted as strings. For example: +# +# en: +# "yes": yup +# enabled: "ON" + +en: + hello: "Hello world" diff --git a/spec/app_rails7/config/puma.rb b/spec/app_rails7/config/puma.rb new file mode 100644 index 0000000..787e4ce --- /dev/null +++ b/spec/app_rails7/config/puma.rb @@ -0,0 +1,38 @@ +# This configuration file will be evaluated by Puma. The top-level methods that +# are invoked here are part of Puma's configuration DSL. For more information +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. +# +# Puma starts a configurable number of processes (workers) and each process +# serves each request in a thread from an internal thread pool. +# +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You +# should only set this value when you want to run 2 or more workers. The +# default is already 1. +# +# The ideal number of threads per worker depends both on how much time the +# application spends waiting for IO operations and on how much you wish to +# prioritize throughput over latency. +# +# As a rule of thumb, increasing the number of threads will increase how much +# traffic a given process can handle (throughput), but due to CRuby's +# Global VM Lock (GVL) it has diminishing returns and will degrade the +# response time (latency) of the application. +# +# The default is set to 3 threads as it's deemed a decent compromise between +# throughput and latency for the average Rails application. +# +# Any libraries that use a connection pool or another resource pool should +# be configured to provide at least as many connections as the number of +# threads. This includes Active Record's `pool` parameter in `database.yml`. +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3) +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. +port ENV.fetch("PORT", 3000) + +# Allow puma to be restarted by `bin/rails restart` command. +plugin :tmp_restart + +# Specify the PID file. Defaults to tmp/pids/server.pid in development. +# In other environments, only set the PID file if requested. +pidfile ENV["PIDFILE"] if ENV["PIDFILE"] diff --git a/spec/app_rails7/config/routes.rb b/spec/app_rails7/config/routes.rb new file mode 100644 index 0000000..48254e8 --- /dev/null +++ b/spec/app_rails7/config/routes.rb @@ -0,0 +1,14 @@ +Rails.application.routes.draw do + # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html + + # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. + # Can be used by load balancers and uptime monitors to verify that the app is live. + get "up" => "rails/health#show", as: :rails_health_check + + # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb) + # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest + # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker + + # Defines the root path route ("/") + # root "posts#index" +end diff --git a/spec/app_rails7/db/migrate b/spec/app_rails7/db/migrate new file mode 120000 index 0000000..256665d --- /dev/null +++ b/spec/app_rails7/db/migrate @@ -0,0 +1 @@ +../../shared/db/migrate \ No newline at end of file diff --git a/spec/app_rails7/db/schema.rb b/spec/app_rails7/db/schema.rb new file mode 100644 index 0000000..46f5bb9 --- /dev/null +++ b/spec/app_rails7/db/schema.rb @@ -0,0 +1,55 @@ +# This file is auto-generated from the current state of the database. Instead +# of editing this file, please use the migrations feature of Active Record to +# incrementally modify your database, and then regenerate this schema definition. +# +# This file is the source Rails uses to define your schema when running `bin/rails +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to +# be faster and is potentially less error prone than running all of your +# migrations from scratch. Old migrations may fail to apply correctly if those +# migrations use external dependencies or application code. +# +# It's strongly recommended that you check this file into your version control system. + +ActiveRecord::Schema[7.2].define(version: 2019_08_12_194128) do + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + + create_table "comments", force: :cascade do |t| + t.text "body" + t.bigint "post_id", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.index ["post_id"], name: "index_comments_on_post_id" + end + + create_table "posts", force: :cascade do |t| + t.bigint "user_id" + t.string "title" + t.text "body" + t.datetime "published_at", precision: nil + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.index ["user_id"], name: "index_posts_on_user_id" + end + + create_table "users", force: :cascade do |t| + t.string "username" + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.integer "age", default: 0, null: false + t.string "email" + t.boolean "active" + t.integer "backup_user_id" + end + + create_table "votes", force: :cascade do |t| + t.string "voteable_type", null: false + t.bigint "voteable_id", null: false + t.integer "vote", null: false + t.bigint "voter_id", null: false + t.datetime "created_at", precision: nil, null: false + t.datetime "updated_at", precision: nil, null: false + t.index ["voteable_type", "voteable_id"], name: "index_votes_on_voteable_type_and_voteable_id" + t.index ["voter_id"], name: "index_votes_on_voter_id" + end +end diff --git a/spec/app_rails5/app/assets/images/.keep b/spec/app_rails7/log/.keep similarity index 100% rename from spec/app_rails5/app/assets/images/.keep rename to spec/app_rails7/log/.keep diff --git a/spec/app_rails7/public/400.html b/spec/app_rails7/public/400.html new file mode 100644 index 0000000..a9db335 --- /dev/null +++ b/spec/app_rails7/public/400.html @@ -0,0 +1,111 @@ + + + + + + + The server cannot process the request due to a client error (400 Bad Request) + + + + + + + + + + + + + +
+
+

The server cannot process the request due to a client error. Please check the request and try again. If you’re the application owner check the logs for more information.

+
+
+ + + + diff --git a/spec/app_rails7/public/404.html b/spec/app_rails7/public/404.html new file mode 100644 index 0000000..606f7c9 --- /dev/null +++ b/spec/app_rails7/public/404.html @@ -0,0 +1,111 @@ + + + + + + + The page you were looking for doesn’t exist (404 Not found) + + + + + + + + + + + + + +
+
+

The page you were looking for doesn’t exist. You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.

+
+
+ + + + diff --git a/spec/app_rails7/public/422.html b/spec/app_rails7/public/422.html new file mode 100644 index 0000000..ca7ff38 --- /dev/null +++ b/spec/app_rails7/public/422.html @@ -0,0 +1,111 @@ + + + + + + + The change you wanted was rejected (422 Unprocessable Entity) + + + + + + + + + + + + + +
+
+

The change you wanted was rejected. Maybe you tried to change something you didn’t have access to. If you’re the application owner check the logs for more information.

+
+
+ + + + diff --git a/spec/app_rails7/public/500.html b/spec/app_rails7/public/500.html new file mode 100644 index 0000000..20fb330 --- /dev/null +++ b/spec/app_rails7/public/500.html @@ -0,0 +1,111 @@ + + + + + + + We’re sorry, but something went wrong (500 Internal Server Error) + + + + + + + + + + + + + +
+
+

We’re sorry, but something went wrong.
If you’re the application owner check the logs for more information.

+
+
+ + + + diff --git a/spec/app_rails7/public/robots.txt b/spec/app_rails7/public/robots.txt new file mode 100644 index 0000000..c19f78a --- /dev/null +++ b/spec/app_rails7/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/spec/lib/modern_searchlogic/column_conditions_spec.rb b/spec/lib/modern_searchlogic/column_conditions_spec.rb index dcfb589..f3d2734 100644 --- a/spec/lib/modern_searchlogic/column_conditions_spec.rb +++ b/spec/lib/modern_searchlogic/column_conditions_spec.rb @@ -1,5 +1,13 @@ require 'rails_helper' +def update_attributes_method_name + if Gem::Version.new(Rails.version) >= Gem::Version.new('6.0.0') + :update! + else + :update_attributes! + end +end + describe ModernSearchlogic::ColumnConditions do shared_examples 'a column condition' do |*args| finder_method, user_attributes, find_by = *args @@ -258,7 +266,7 @@ end specify 'custom scopes should work' do - user.posts.first.update_attributes!(:published_at => Time.now) + user.posts.first.send(update_attributes_method_name, :published_at => Time.now) User.posts_published.first.should == user end @@ -279,4 +287,28 @@ User.not_active.all.should == [inactive] end end + + context 'abstract class' do + it 'should not try to add searchlogic methods' do + class MyApplicationRecord < ActiveRecord::Base + self.abstract_class = true + end + + MyApplicationRecord.should_not respond_to :id_eq + end + + context 'extended by a non-abstract class' do + it 'should add searchlogic methods' do + class MyApplicationRecord < ActiveRecord::Base + self.abstract_class = true + end + + class ScopedUser < MyApplicationRecord + self.table_name = 'users' + end + + ScopedUser.should respond_to :id_eq + end + end + end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 560a4f1..6b547d6 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -31,8 +31,10 @@ end RSpec.configure do |config| - # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - config.fixture_path = "#{::Rails.root}/spec/fixtures" + if rails_major_version < 7 + # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures + config.fixture_path = "#{::Rails.root}/spec/fixtures" + end # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false @@ -54,3 +56,18 @@ # https://relishapp.com/rspec/rspec-rails/docs config.infer_spec_type_from_file_location! end + +begin + RSpec::Matchers::BuiltIn::OperatorMatcher.class_eval do + private + + def has_non_generic_implementation_of?(op) + [ + ::Ruby3BackwardCompatibility::ObjectCompatibility, + ::Kernel, + ].exclude?(Support.method_handle_for(@actual, op).owner) + rescue NameError + false + end + end +end diff --git a/spec/ruby3_compatibility.rb b/spec/ruby3_compatibility.rb new file mode 100644 index 0000000..73e65b5 --- /dev/null +++ b/spec/ruby3_compatibility.rb @@ -0,0 +1,11 @@ +unless File.respond_to?(:exists?) + class << File + alias_method :exists?, :exist? + end +end + +unless Dir.respond_to?(:exists?) + class << Dir + alias_method :exists?, :exist? + end +end diff --git a/spec/shared/db/migrate/20150523192524_create_users.rb b/spec/shared/db/migrate/20150523192524_create_users.rb index 78f2820..9b1cef8 100644 --- a/spec/shared/db/migrate/20150523192524_create_users.rb +++ b/spec/shared/db/migrate/20150523192524_create_users.rb @@ -1,4 +1,6 @@ -class CreateUsers < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class CreateUsers < ActiveRecordMigration def change create_table :users do |t| t.string :username diff --git a/spec/shared/db/migrate/20150523192604_create_posts.rb b/spec/shared/db/migrate/20150523192604_create_posts.rb index 33e0536..cdc684d 100644 --- a/spec/shared/db/migrate/20150523192604_create_posts.rb +++ b/spec/shared/db/migrate/20150523192604_create_posts.rb @@ -1,4 +1,6 @@ -class CreatePosts < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class CreatePosts < ActiveRecordMigration def change create_table :posts do |t| t.belongs_to :user diff --git a/spec/shared/db/migrate/20150523204738_add_age_to_users.rb b/spec/shared/db/migrate/20150523204738_add_age_to_users.rb index f4ce7c0..0e45a76 100644 --- a/spec/shared/db/migrate/20150523204738_add_age_to_users.rb +++ b/spec/shared/db/migrate/20150523204738_add_age_to_users.rb @@ -1,4 +1,6 @@ -class AddAgeToUsers < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class AddAgeToUsers < ActiveRecordMigration def change add_column :users, :age, :integer, :null => false, :default => 0 end diff --git a/spec/shared/db/migrate/20150525132738_comments.rb b/spec/shared/db/migrate/20150525132738_comments.rb index 921f0ba..e56ec3d 100644 --- a/spec/shared/db/migrate/20150525132738_comments.rb +++ b/spec/shared/db/migrate/20150525132738_comments.rb @@ -1,4 +1,6 @@ -class Comments < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class Comments < ActiveRecordMigration def change create_table :comments do |t| t.text :body diff --git a/spec/shared/db/migrate/20150526132112_add_email_to_users.rb b/spec/shared/db/migrate/20150526132112_add_email_to_users.rb index 1370f7d..d43a36b 100644 --- a/spec/shared/db/migrate/20150526132112_add_email_to_users.rb +++ b/spec/shared/db/migrate/20150526132112_add_email_to_users.rb @@ -1,4 +1,6 @@ -class AddEmailToUsers < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class AddEmailToUsers < ActiveRecordMigration def change add_column :users, :email, :string end diff --git a/spec/shared/db/migrate/20160719181005_add_votes.rb b/spec/shared/db/migrate/20160719181005_add_votes.rb index 20ace4d..30bf572 100644 --- a/spec/shared/db/migrate/20160719181005_add_votes.rb +++ b/spec/shared/db/migrate/20160719181005_add_votes.rb @@ -1,4 +1,6 @@ -class AddVotes < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class AddVotes < ActiveRecordMigration def change create_table :votes do |t| t.belongs_to :voteable, polymorphic: true, null: false diff --git a/spec/shared/db/migrate/20190727005829_add_active_to_users.rb b/spec/shared/db/migrate/20190727005829_add_active_to_users.rb index 9193194..f88ff3f 100644 --- a/spec/shared/db/migrate/20190727005829_add_active_to_users.rb +++ b/spec/shared/db/migrate/20190727005829_add_active_to_users.rb @@ -1,4 +1,6 @@ -class AddActiveToUsers < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class AddActiveToUsers < ActiveRecordMigration def change add_column :users, :active, :boolean end diff --git a/spec/shared/db/migrate/20190812194128_add_backup_user_id_to_user.rb b/spec/shared/db/migrate/20190812194128_add_backup_user_id_to_user.rb index 46592fd..ad59639 100644 --- a/spec/shared/db/migrate/20190812194128_add_backup_user_id_to_user.rb +++ b/spec/shared/db/migrate/20190812194128_add_backup_user_id_to_user.rb @@ -1,4 +1,6 @@ -class AddBackupUserIdToUser < ActiveRecord::Migration +require_relative '../../migration_compatibility_helper' + +class AddBackupUserIdToUser < ActiveRecordMigration def change add_column :users, :backup_user_id, :integer end diff --git a/spec/shared/migration_compatibility_helper.rb b/spec/shared/migration_compatibility_helper.rb new file mode 100644 index 0000000..71d443a --- /dev/null +++ b/spec/shared/migration_compatibility_helper.rb @@ -0,0 +1,6 @@ +ActiveRecordMigration = + if ActiveRecord::VERSION::MAJOR >= 5 + ActiveRecord::Migration[5.2] + else + ActiveRecord::Migration + end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 436801d..1bd9434 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -30,7 +30,9 @@ # # => "be bigger than 2 and smaller than 4" # ...rather than: # # => "be bigger than 2" - expectations.include_chain_clauses_in_custom_matcher_descriptions = true + if expectations.respond_to?(:include_chain_clauses_in_custom_matcher_descriptions=) + expectations.include_chain_clauses_in_custom_matcher_descriptions = true + end expectations.syntax = [:should, :expect] end @@ -40,7 +42,9 @@ # Prevents you from mocking or stubbing a method that does not exist on # a real object. This is generally recommended, and will default to # `true` in RSpec 4. - mocks.verify_partial_doubles = true + if mocks.respond_to?(:verify_partial_doubles=) + mocks.verify_partial_doubles = true + end end # The settings below are suggested to provide a good initial experience