From 5ea5c6c5e2698aac27466fc5bfd9f7c4c3119a00 Mon Sep 17 00:00:00 2001 From: Kapil Sachdev Date: Wed, 18 Nov 2020 19:17:12 +0530 Subject: [PATCH] feat: Add rails 6.1.0.rc1 support - Remove ruby 2.4 and rails 4.2 --- .rubocop.yml | 2 +- .travis.yml | 19 +- Appraisals | 154 +++-- Gemfile | 7 +- Gemfile.lock | 51 +- README.md | 6 +- gemfiles/rails_4_2.gemfile | 37 -- gemfiles/rails_4_2.gemfile.lock | 258 -------- gemfiles/rails_5_0.gemfile | 23 +- gemfiles/rails_5_0.gemfile.lock | 176 +++--- gemfiles/rails_5_1.gemfile | 25 +- gemfiles/rails_5_1.gemfile.lock | 199 +++--- gemfiles/rails_5_2.gemfile | 29 +- gemfiles/rails_5_2.gemfile.lock | 209 ++++--- gemfiles/rails_6_0.gemfile | 26 +- gemfiles/rails_6_0.gemfile.lock | 284 +++++---- gemfiles/rails_6_1.gemfile | 37 ++ gemfiles/rails_6_1.gemfile.lock | 301 +++++++++ .../action_controller/callback_matcher.rb | 87 --- lib/shoulda/matchers/active_model.rb | 1 - .../allow_mass_assignment_of_matcher.rb | 161 ----- .../active_record/association_matcher.rb | 2 +- lib/shoulda/matchers/rails_shim.rb | 17 +- shoulda-matchers.gemspec | 4 +- .../unit/active_record/create_table.rb | 14 - .../unit/helpers/action_pack_versions.rb | 8 - .../unit/helpers/active_record_versions.rb | 36 -- spec/support/unit/helpers/rails_versions.rb | 4 - .../callback_matcher_spec.rb | 14 - .../action_controller/permit_matcher_spec.rb | 6 +- .../allow_mass_assignment_of_matcher_spec.rb | 123 ---- .../validate_presence_of_matcher_spec.rb | 88 --- .../active_record/association_matcher_spec.rb | 579 +++++++----------- .../define_enum_for_matcher_spec.rb | 265 ++++---- .../have_db_index_matcher_spec.rb | 3 +- .../have_secure_token_matcher_spec.rb | 284 +++++---- .../validate_uniqueness_of_matcher_spec.rb | 46 +- 37 files changed, 1456 insertions(+), 2129 deletions(-) delete mode 100644 gemfiles/rails_4_2.gemfile delete mode 100644 gemfiles/rails_4_2.gemfile.lock create mode 100644 gemfiles/rails_6_1.gemfile create mode 100644 gemfiles/rails_6_1.gemfile.lock delete mode 100644 lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb delete mode 100644 spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb diff --git a/.rubocop.yml b/.rubocop.yml index 659b0e8f8..889265e66 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ require: - rubocop-rails AllCops: NewCops: disable - TargetRubyVersion: 2.4 + TargetRubyVersion: 2.5 Exclude: - 'gemfiles/*' Bundler/OrderedGems: diff --git a/.travis.yml b/.travis.yml index 0a913bba7..507ae6e20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: ruby -dist: xenial +dist: bionic services: - postgresql env: @@ -10,32 +10,17 @@ rvm: - 2.7.2 - 2.6.6 - 2.5.8 - - 2.4.10 gemfile: + - gemfiles/rails_6_1.gemfile - gemfiles/rails_6_0.gemfile - gemfiles/rails_5_2.gemfile - gemfiles/rails_5_1.gemfile - gemfiles/rails_5_0.gemfile - - gemfiles/rails_4_2.gemfile -matrix: - exclude: - - rvm: 2.7.2 - gemfile: gemfiles/rails_4_2.gemfile - - rvm: 2.6.6 - gemfile: gemfiles/rails_4_2.gemfile - - rvm: 2.4.10 - gemfile: gemfiles/rails_6_0.gemfile cache: directories: - /home/travis/.rvm/gems/ruby-2.7.2 - /home/travis/.rvm/gems/ruby-2.6.6 - /home/travis/.rvm/gems/ruby-2.5.8 - - /home/travis/.rvm/gems/ruby-2.4.10 -# Source: -before_install: - - gem update --system --force --no-document - - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - - gem install bundler -v '< 2' --no-document install: "bundle install --jobs=3 --retry=3" script: "bundle exec rake" branches: diff --git a/Appraisals b/Appraisals index de9fea76a..611af6506 100644 --- a/Appraisals +++ b/Appraisals @@ -3,19 +3,16 @@ # best to keep the gems here in the same order as they're listed there so you # can compare them more easily. -# Needed for Rails 5+ controller tests -controller_test_dependency = proc do - gem 'rails-controller-testing', '>= 1.0.1' -end - shared_spring_dependencies = proc do gem 'spring' gem 'spring-commands-rspec' end shared_test_dependencies = proc do - gem 'rspec-rails', '~> 3.9' - gem 'shoulda-context', '~> 1.2.0' + # Needed for Rails 5+ controller tests + gem 'rails-controller-testing', '>= 1.0.1' + gem 'rspec-rails', '~> 4.0' + gem 'shoulda-context', '~> 2.0' end shared_dependencies = proc do @@ -23,114 +20,105 @@ shared_dependencies = proc do instance_eval(&shared_test_dependencies) end -appraise 'rails_4_2' do - instance_eval(&shared_dependencies) - - gem 'rails', '4.2.11.1' - gem 'sass-rails', '~> 5.0' - gem 'uglifier', '>= 1.3.0' - gem 'coffee-rails', '~> 4.1.0' - gem 'jquery-rails' - gem 'turbolinks' - gem 'jbuilder', '~> 2.0' - gem 'sdoc', '~> 0.4.0', group: :doc - gem 'bcrypt', '~> 3.1.7' - - # Other dependencies - gem 'activeresource', '4.0.0' - gem 'json', '~> 1.4' - gem 'protected_attributes', '~> 1.0.6' - - # Database adapters - gem 'pg', '~> 0.18' - gem 'sqlite3', '~> 1.3.6' -end - appraise 'rails_5_0' do instance_eval(&shared_dependencies) - instance_eval(&controller_test_dependency) + gem 'rails', '5.0.7.2' - gem 'puma', '~> 3.0' - gem 'sass-rails', '~> 5.0' + gem 'puma', '~> 5.0' + gem 'sass-rails', '~> 6.0' gem 'jquery-rails' gem 'turbolinks', '~> 5' - gem 'jbuilder', '~> 2.5' - gem 'bcrypt', '~> 3.1.7' - gem 'listen', '~> 3.0.5' + gem 'jbuilder', '~> 2.10' + gem 'bcrypt', '~> 3.1.16' + gem 'listen', '~> 3.3' gem 'spring-watcher-listen', '~> 2.0.0' # Database adapters gem 'pg', '~> 0.18' - gem 'sqlite3', '~> 1.3.6' + gem 'sqlite3', '~> 1.3.13' end appraise 'rails_5_1' do instance_eval(&shared_dependencies) - instance_eval(&controller_test_dependency) + gem 'rails', '5.1.7' - gem 'puma', '~> 3.7' - gem 'sass-rails', '~> 5.0' - gem 'turbolinks', '~> 5' - gem 'jbuilder', '~> 2.5' - gem 'bcrypt', '~> 3.1.7' - gem 'capybara', '~> 2.13' + gem 'puma', '~> 5.0' + gem 'sass-rails', '~> 6.0' + gem 'turbolinks', '~> 5.2' + gem 'jbuilder', '~> 2.10' + gem 'bcrypt', '~> 3.1.16' + gem 'capybara', '~> 3.33' gem 'selenium-webdriver' - gem 'listen', '>= 3.0.5', '< 3.2' + gem 'listen', '~> 3.3' gem 'spring-watcher-listen', '~> 2.0.0' # Database adapters gem 'pg', '~> 0.18' - gem 'sqlite3', '~> 1.3.6' + gem 'sqlite3', '~> 1.4' end appraise 'rails_5_2' do instance_eval(&shared_dependencies) - instance_eval(&controller_test_dependency) + gem 'rails', '5.2.4.1' - gem 'puma', '~> 3.11' - gem 'bootsnap', '>= 1.1.0', require: false - gem 'sass-rails', '~> 5.0' - gem 'turbolinks', '~> 5' - gem 'jbuilder', '~> 2.5' - gem 'bcrypt', '~> 3.1.7' - gem 'capybara', '~> 3.1.1' + gem 'puma', '~> 5.0' + gem 'bootsnap', '>= 1.5.0', require: false + gem 'sass-rails', '~> 6.0' + gem 'turbolinks', '~> 5.2' + gem 'jbuilder', '~> 2.10' + gem 'bcrypt', '~> 3.1.16' + gem 'capybara', '~> 3.33' gem 'selenium-webdriver' gem 'chromedriver-helper' - gem 'listen', '>= 3.0.5', '< 3.2' + gem 'listen', '~> 3.3' gem 'spring-watcher-listen', '~> 2.0.0' # Database adapters - gem 'pg', '~> 0.18' - gem 'sqlite3', '~> 1.3.6' + gem 'pg', '>= 0.18', '< 2.0' + gem 'sqlite3', '~> 1.4' +end + +appraise 'rails_6_0' do + instance_eval(&shared_dependencies) + + gem 'rails', '6.0.3.4' + gem 'puma', '~> 5.0' + gem 'bootsnap', '>= 1.5.0', require: false + gem 'sass-rails', '>= 6' + gem 'turbolinks', '~> 5.2' + gem 'jbuilder', '~> 2.10' + gem 'bcrypt', '~> 3.1.16' + gem 'capybara', '>= 3.33' + gem 'listen', '~> 3.3' + gem 'spring-watcher-listen', '~> 2.0.0' + gem 'selenium-webdriver' + gem 'webdrivers' + + # Database adapters + gem 'pg', '>= 0.18', '< 2.0' + gem 'sqlite3', '~> 1.4' end -if Gem::Requirement.new('>= 2.5.0'). - satisfied_by?(Gem::Version.new(RUBY_VERSION)) - appraise 'rails_6_0' do - instance_eval(&shared_dependencies) - instance_eval(&controller_test_dependency) - - gem 'rails', '6.0.2.1' - gem 'puma', '~> 4.1' - gem 'bootsnap', '>= 1.4.2', require: false - gem 'sass-rails', '>= 6' - gem 'turbolinks', '~> 5' - gem 'jbuilder', '~> 2.7' - gem 'bcrypt', '~> 3.1.7' - gem 'capybara', '>= 2.15' - gem 'listen', '>= 3.0.5', '< 3.2' - gem 'spring-watcher-listen', '~> 2.0.0' - gem 'selenium-webdriver' - gem 'webdrivers' - - # Other dependencies - gem 'actiontext', '~> 6.0.2.1' - - # Database adapters - gem 'pg', '>= 0.18', '< 2.0' - gem 'sqlite3', '~> 1.4' - end +appraise 'rails_6_1' do + instance_eval(&shared_dependencies) + + gem 'rails', '6.1.0.rc1' + gem 'puma', '~> 5.0' + gem 'bootsnap', '>= 1.5.0', require: false + gem 'sass-rails', '>= 6' + gem 'turbolinks', '~> 5.2' + gem 'jbuilder', '~> 2.10' + gem 'bcrypt', '~> 3.1.16' + gem 'capybara', '>= 3.33' + gem 'listen', '~> 3.3' + gem 'spring-watcher-listen', '~> 2.0.0' + gem 'selenium-webdriver' + gem 'webdrivers' + + # Database adapters + gem 'pg', '>= 0.18', '< 2.0' + gem 'sqlite3', '~> 1.4' end diff --git a/Gemfile b/Gemfile index 879359bad..4a76e138d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,11 +1,10 @@ source 'https://rubygems.org' -gem 'appraisal', '2.2.0' -gem 'bundler', '~> 1.1' +gem 'appraisal' gem 'pry' gem 'pry-byebug' -gem 'rake', '13.0.1' -gem 'rspec', '~> 3.9' +gem 'rake' +gem 'rspec' gem 'rubocop', require: false gem 'rubocop-packaging', require: false gem 'rubocop-rails', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 5364786e0..d372906ad 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GEM minitest (~> 5.1) tzinfo (~> 1.1) zeitwerk (~> 2.2, >= 2.2.2) - appraisal (2.2.0) + appraisal (2.3.0) bundler rake thor (>= 0.14.0) @@ -15,13 +15,13 @@ GEM byebug (11.1.3) coderay (1.1.3) concurrent-ruby (1.1.7) - diff-lcs (1.3) + diff-lcs (1.4.4) fssm (0.2.10) i18n (1.8.5) concurrent-ruby (~> 1.0) method_source (1.0.0) minitest (5.14.2) - parallel (1.19.2) + parallel (1.20.0) parser (2.7.2.0) ast (~> 2.4.1) pry (0.13.1) @@ -36,30 +36,30 @@ GEM redcarpet (3.5.0) regexp_parser (1.8.2) rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (1.0.0) + rspec-support (~> 3.10.0) + rspec-support (3.10.0) + rubocop (1.3.1) parallel (~> 1.10) parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.6.0) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (1.1.0) + rubocop-ast (1.1.1) parser (>= 2.7.1.5) rubocop-packaging (0.5.1) rubocop (>= 0.89, < 2.0) @@ -68,14 +68,14 @@ GEM rack (>= 1.1) rubocop (>= 0.87.0) ruby-progressbar (1.10.1) - thor (0.20.0) + thor (1.0.1) thread_safe (0.3.6) - tzinfo (1.2.7) + tzinfo (1.2.8) thread_safe (~> 0.1) unicode-display_width (1.7.0) warnings_logger (0.1.1) yard (0.9.25) - zeitwerk (2.4.0) + zeitwerk (2.4.1) zeus (0.15.14) method_source (>= 0.6.7) @@ -83,15 +83,14 @@ PLATFORMS ruby DEPENDENCIES - appraisal (= 2.2.0) - bundler (~> 1.1) + appraisal fssm pry pry-byebug - rake (= 13.0.1) + rake redcarpet rouge - rspec (~> 3.9) + rspec rubocop rubocop-packaging rubocop-rails @@ -100,4 +99,4 @@ DEPENDENCIES zeus BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/README.md b/README.md index 7286effe6..9bdb5af30 100644 --- a/README.md +++ b/README.md @@ -470,11 +470,13 @@ machine, understanding the codebase, and creating a good pull request. ## Compatibility -Shoulda Matchers is [tested][travis] and supported against Ruby 2.4+, Rails -4.2+, RSpec 3.x, and Minitest 5.x. +Shoulda Matchers is [tested][travis] and supported against Ruby 2.5+, Rails +5.0+, RSpec 3.x, and Minitest 5.x. +For Ruby < 2.5 and Rails < 5.0 compatibility, please use [v4.4.1][v4.4.1]. For Ruby < 2.4 and Rails < 4.1 compatibility, please use [v3.1.3][v3.1.3]. +[v4.4.1]: https://github.com/thoughtbot/shoulda-matchers/tree/v4.4.1 [v3.1.3]: https://github.com/thoughtbot/shoulda-matchers/tree/v3.1.3 ## Versioning diff --git a/gemfiles/rails_4_2.gemfile b/gemfiles/rails_4_2.gemfile deleted file mode 100644 index a89c23df4..000000000 --- a/gemfiles/rails_4_2.gemfile +++ /dev/null @@ -1,37 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "appraisal", "2.2.0" -gem "bundler", "~> 1.1" -gem "pry" -gem "pry-byebug" -gem "rake", "13.0.1" -gem "rspec", "~> 3.9" -gem "rubocop", require: false -gem "rubocop-packaging", require: false -gem "rubocop-rails", require: false -gem "warnings_logger" -gem "zeus", require: false -gem "fssm" -gem "redcarpet" -gem "rouge" -gem "yard" -gem "spring" -gem "spring-commands-rspec" -gem "rspec-rails", "~> 3.9" -gem "shoulda-context", "~> 1.2.0" -gem "rails", "4.2.11.1" -gem "sass-rails", "~> 5.0" -gem "uglifier", ">= 1.3.0" -gem "coffee-rails", "~> 4.1.0" -gem "jquery-rails" -gem "turbolinks" -gem "jbuilder", "~> 2.0" -gem "sdoc", "~> 0.4.0", group: :doc -gem "bcrypt", "~> 3.1.7" -gem "activeresource", "4.0.0" -gem "json", "~> 1.4" -gem "protected_attributes", "~> 1.0.6" -gem "pg", "~> 0.18" -gem "sqlite3", "~> 1.3.6" diff --git a/gemfiles/rails_4_2.gemfile.lock b/gemfiles/rails_4_2.gemfile.lock deleted file mode 100644 index 42af8d843..000000000 --- a/gemfiles/rails_4_2.gemfile.lock +++ /dev/null @@ -1,258 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - actionmailer (4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.11.1) - actionview (= 4.2.11.1) - activesupport (= 4.2.11.1) - 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.11.1) - activesupport (= 4.2.11.1) - 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.11.1) - activesupport (= 4.2.11.1) - globalid (>= 0.3.0) - activemodel (4.2.11.1) - activesupport (= 4.2.11.1) - builder (~> 3.1) - activerecord (4.2.11.1) - activemodel (= 4.2.11.1) - activesupport (= 4.2.11.1) - arel (~> 6.0) - activeresource (4.0.0) - activemodel (~> 4.0) - activesupport (~> 4.0) - rails-observers (~> 0.1.1) - activesupport (4.2.11.1) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.2.0) - bundler - rake - thor (>= 0.14.0) - arel (6.0.4) - ast (2.4.1) - bcrypt (3.1.13) - builder (3.2.4) - byebug (11.1.3) - coderay (1.1.3) - coffee-rails (4.1.1) - coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) - coffee-script (2.4.1) - coffee-script-source - execjs - coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) - crass (1.0.5) - diff-lcs (1.3) - erubis (2.7.0) - execjs (2.7.0) - ffi (1.11.3) - fssm (0.2.10) - globalid (0.4.2) - activesupport (>= 4.2.0) - i18n (0.9.5) - concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (4.3.5) - rails-dom-testing (>= 1, < 3) - railties (>= 4.2.0) - thor (>= 0.14, < 2.0) - json (1.8.6) - loofah (2.4.0) - crass (~> 1.0.2) - nokogiri (>= 1.5.9) - mail (2.7.1) - mini_mime (>= 0.1.1) - method_source (1.0.0) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.13.0) - nokogiri (1.10.7) - mini_portile2 (~> 2.4.0) - parallel (1.19.2) - parser (2.7.1.4) - ast (~> 2.4.1) - pg (0.21.0) - protected_attributes (1.0.9) - activemodel (>= 4.0.1, < 5.0) - pry (0.13.1) - coderay (~> 1.1) - method_source (~> 1.0) - pry-byebug (3.9.0) - byebug (~> 11.0) - pry (~> 0.13.0) - rack (1.6.13) - rack-test (0.6.3) - rack (>= 1.0) - rails (4.2.11.1) - actionmailer (= 4.2.11.1) - actionpack (= 4.2.11.1) - actionview (= 4.2.11.1) - activejob (= 4.2.11.1) - activemodel (= 4.2.11.1) - activerecord (= 4.2.11.1) - activesupport (= 4.2.11.1) - bundler (>= 1.3.0, < 2.0) - railties (= 4.2.11.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - 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.3.0) - loofah (~> 2.3) - rails-observers (0.1.5) - activemodel (>= 4.0) - railties (4.2.11.1) - actionpack (= 4.2.11.1) - activesupport (= 4.2.11.1) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rainbow (3.0.0) - rake (13.0.1) - rb-fsevent (0.10.3) - rb-inotify (0.10.1) - ffi (~> 1.0) - rdoc (4.3.0) - redcarpet (3.5.0) - regexp_parser (1.7.1) - rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (0.89.1) - parallel (~> 1.10) - parser (>= 2.7.1.1) - rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) - rexml - rubocop-ast (>= 0.3.0, < 1.0) - ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.3.0) - parser (>= 2.7.1.4) - rubocop-packaging (0.4.0) - rubocop (~> 0.89) - rubocop-rails (2.4.1) - rack (>= 1.1) - rubocop (>= 0.72.0) - ruby-progressbar (1.10.1) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - sdoc (0.4.2) - json (~> 1.7, >= 1.7.7) - rdoc (~> 4.0) - shoulda-context (1.2.2) - spring (2.1.0) - spring-commands-rspec (1.0.4) - spring (>= 0.9.1) - sprockets (3.7.2) - concurrent-ruby (~> 1.0) - rack (> 1, < 3) - sprockets-rails (3.2.1) - actionpack (>= 4.0) - activesupport (>= 4.0) - sprockets (>= 3.0.0) - sqlite3 (1.3.13) - thor (1.0.1) - thread_safe (0.3.6) - tilt (2.0.10) - turbolinks (5.2.1) - turbolinks-source (~> 5.2) - turbolinks-source (5.2.0) - tzinfo (1.2.6) - thread_safe (~> 0.1) - uglifier (4.2.0) - execjs (>= 0.3.0, < 3) - unicode-display_width (1.7.0) - warnings_logger (0.1.1) - yard (0.9.20) - zeus (0.15.14) - method_source (>= 0.6.7) - -PLATFORMS - ruby - -DEPENDENCIES - activeresource (= 4.0.0) - appraisal (= 2.2.0) - bcrypt (~> 3.1.7) - bundler (~> 1.1) - coffee-rails (~> 4.1.0) - fssm - jbuilder (~> 2.0) - jquery-rails - json (~> 1.4) - pg (~> 0.18) - protected_attributes (~> 1.0.6) - pry - pry-byebug - rails (= 4.2.11.1) - rake (= 13.0.1) - redcarpet - rouge - rspec (~> 3.9) - rspec-rails (~> 3.9) - rubocop - rubocop-packaging - rubocop-rails - sass-rails (~> 5.0) - sdoc (~> 0.4.0) - shoulda-context (~> 1.2.0) - spring - spring-commands-rspec - sqlite3 (~> 1.3.6) - turbolinks - uglifier (>= 1.3.0) - warnings_logger - yard - zeus - -BUNDLED WITH - 1.17.3 diff --git a/gemfiles/rails_5_0.gemfile b/gemfiles/rails_5_0.gemfile index 2513e53be..546282cda 100644 --- a/gemfiles/rails_5_0.gemfile +++ b/gemfiles/rails_5_0.gemfile @@ -2,12 +2,11 @@ source "https://rubygems.org" -gem "appraisal", "2.2.0" -gem "bundler", "~> 1.1" +gem "appraisal" gem "pry" gem "pry-byebug" -gem "rake", "13.0.1" -gem "rspec", "~> 3.9" +gem "rake" +gem "rspec" gem "rubocop", require: false gem "rubocop-packaging", require: false gem "rubocop-rails", require: false @@ -19,17 +18,17 @@ gem "rouge" gem "yard" gem "spring" gem "spring-commands-rspec" -gem "rspec-rails", "~> 3.9" -gem "shoulda-context", "~> 1.2.0" gem "rails-controller-testing", ">= 1.0.1" +gem "rspec-rails", "~> 4.0" +gem "shoulda-context", "~> 2.0" gem "rails", "5.0.7.2" -gem "puma", "~> 3.0" -gem "sass-rails", "~> 5.0" +gem "puma", "~> 5.0" +gem "sass-rails", "~> 6.0" gem "jquery-rails" gem "turbolinks", "~> 5" -gem "jbuilder", "~> 2.5" -gem "bcrypt", "~> 3.1.7" -gem "listen", "~> 3.0.5" +gem "jbuilder", "~> 2.10" +gem "bcrypt", "~> 3.1.16" +gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "pg", "~> 0.18" -gem "sqlite3", "~> 1.3.6" +gem "sqlite3", "~> 1.3.13" diff --git a/gemfiles/rails_5_0.gemfile.lock b/gemfiles/rails_5_0.gemfile.lock index c0b5f9f63..015709f41 100644 --- a/gemfiles/rails_5_0.gemfile.lock +++ b/gemfiles/rails_5_0.gemfile.lock @@ -38,36 +38,36 @@ GEM i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - appraisal (2.2.0) + appraisal (2.3.0) bundler rake thor (>= 0.14.0) arel (7.1.4) ast (2.4.1) - bcrypt (3.1.13) + bcrypt (3.1.16) builder (3.2.4) byebug (11.1.3) coderay (1.1.3) - concurrent-ruby (1.1.5) - crass (1.0.5) - diff-lcs (1.3) + concurrent-ruby (1.1.7) + crass (1.0.6) + diff-lcs (1.4.4) erubis (2.7.0) - ffi (1.11.3) + ffi (1.13.1) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.7.0) + i18n (1.8.5) concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.0) - jquery-rails (4.3.5) + jbuilder (2.10.1) + activesupport (>= 5.0.0) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - listen (3.0.8) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - loofah (2.4.0) + listen (3.3.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -75,12 +75,12 @@ GEM method_source (1.0.0) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - nio4r (2.5.2) - nokogiri (1.10.7) + minitest (5.14.2) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - parallel (1.19.2) - parser (2.7.1.4) + parallel (1.20.0) + parser (2.7.2.0) ast (~> 2.4.1) pg (0.21.0) pry (0.13.1) @@ -89,8 +89,9 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - puma (3.12.2) - rack (2.2.2) + puma (5.0.4) + nio4r (~> 2.0) + rack (2.2.3) rack-test (0.6.3) rack (>= 1.0) rails (5.0.7.2) @@ -105,10 +106,10 @@ GEM bundler (>= 1.3.0) railties (= 5.0.7.2) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -122,73 +123,73 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (13.0.1) - rb-fsevent (0.10.3) + rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.0) - regexp_parser (1.7.1) + regexp_parser (1.8.2) rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (0.89.1) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + rubocop (1.3.1) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.3.0, < 1.0) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.3.0) - parser (>= 2.7.1.4) - rubocop-packaging (0.4.0) - rubocop (~> 0.89) - rubocop-rails (2.4.1) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + rubocop-packaging (0.5.1) + rubocop (>= 0.89, < 2.0) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) + rubocop (>= 0.87.0) ruby-progressbar (1.10.1) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - shoulda-context (1.2.2) - spring (2.1.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + shoulda-context (2.0.0) + spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.2) + sprockets (4.0.2) 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) @@ -199,14 +200,14 @@ GEM turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.6) + tzinfo (1.2.8) thread_safe (~> 0.1) unicode-display_width (1.7.0) warnings_logger (0.1.1) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) - yard (0.9.20) + websocket-extensions (0.1.5) + yard (0.9.25) zeus (0.15.14) method_source (>= 0.6.7) @@ -214,37 +215,36 @@ PLATFORMS ruby DEPENDENCIES - appraisal (= 2.2.0) - bcrypt (~> 3.1.7) - bundler (~> 1.1) + appraisal + bcrypt (~> 3.1.16) fssm - jbuilder (~> 2.5) + jbuilder (~> 2.10) jquery-rails - listen (~> 3.0.5) + listen (~> 3.3) pg (~> 0.18) pry pry-byebug - puma (~> 3.0) + puma (~> 5.0) rails (= 5.0.7.2) rails-controller-testing (>= 1.0.1) - rake (= 13.0.1) + rake redcarpet rouge - rspec (~> 3.9) - rspec-rails (~> 3.9) + rspec + rspec-rails (~> 4.0) rubocop rubocop-packaging rubocop-rails - sass-rails (~> 5.0) - shoulda-context (~> 1.2.0) + sass-rails (~> 6.0) + shoulda-context (~> 2.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) - sqlite3 (~> 1.3.6) + sqlite3 (~> 1.3.13) turbolinks (~> 5) warnings_logger yard zeus BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/gemfiles/rails_5_1.gemfile b/gemfiles/rails_5_1.gemfile index 1da437b14..7a779d4de 100644 --- a/gemfiles/rails_5_1.gemfile +++ b/gemfiles/rails_5_1.gemfile @@ -2,12 +2,11 @@ source "https://rubygems.org" -gem "appraisal", "2.2.0" -gem "bundler", "~> 1.1" +gem "appraisal" gem "pry" gem "pry-byebug" -gem "rake", "13.0.1" -gem "rspec", "~> 3.9" +gem "rake" +gem "rspec" gem "rubocop", require: false gem "rubocop-packaging", require: false gem "rubocop-rails", require: false @@ -19,18 +18,18 @@ gem "rouge" gem "yard" gem "spring" gem "spring-commands-rspec" -gem "rspec-rails", "~> 3.9" -gem "shoulda-context", "~> 1.2.0" gem "rails-controller-testing", ">= 1.0.1" +gem "rspec-rails", "~> 4.0" +gem "shoulda-context", "~> 2.0" gem "rails", "5.1.7" -gem "puma", "~> 3.7" -gem "sass-rails", "~> 5.0" +gem "puma", "~> 5.0" +gem "sass-rails", "~> 6.0" gem "turbolinks", "~> 5" -gem "jbuilder", "~> 2.5" -gem "bcrypt", "~> 3.1.7" -gem "capybara", "~> 2.13" +gem "jbuilder", "~> 2.10" +gem "bcrypt", "~> 3.1.16" +gem "capybara", "~> 3.33" gem "selenium-webdriver" -gem "listen", ">= 3.0.5", "< 3.2" +gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "pg", "~> 0.18" -gem "sqlite3", "~> 1.3.6" +gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails_5_1.gemfile.lock b/gemfiles/rails_5_1.gemfile.lock index 4289da509..67a942dba 100644 --- a/gemfiles/rails_5_1.gemfile.lock +++ b/gemfiles/rails_5_1.gemfile.lock @@ -40,41 +40,41 @@ GEM tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - appraisal (2.2.0) + appraisal (2.3.0) bundler rake thor (>= 0.14.0) arel (8.0.0) ast (2.4.1) - bcrypt (3.1.13) + bcrypt (3.1.16) builder (3.2.4) byebug (11.1.3) - capybara (2.18.0) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) childprocess (3.0.0) coderay (1.1.3) - concurrent-ruby (1.1.5) - crass (1.0.5) - diff-lcs (1.3) - erubi (1.9.0) - ffi (1.11.3) + concurrent-ruby (1.1.7) + crass (1.0.6) + diff-lcs (1.4.4) + erubi (1.10.0) + ffi (1.13.1) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.7.0) + i18n (1.8.5) concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.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.4.0) + jbuilder (2.10.1) + activesupport (>= 5.0.0) + listen (3.3.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -82,12 +82,12 @@ GEM method_source (1.0.0) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - nio4r (2.5.2) - nokogiri (1.10.7) + minitest (5.14.2) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - parallel (1.19.2) - parser (2.7.1.4) + parallel (1.20.0) + parser (2.7.2.0) ast (~> 2.4.1) pg (0.21.0) pry (0.13.1) @@ -96,9 +96,10 @@ GEM pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - public_suffix (4.0.1) - puma (3.12.2) - rack (2.2.2) + public_suffix (4.0.6) + puma (5.0.4) + nio4r (~> 2.0) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.1.7) @@ -113,10 +114,10 @@ GEM bundler (>= 1.3.0) railties (= 5.1.7) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -130,98 +131,97 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (13.0.1) - rb-fsevent (0.10.3) + rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.0) - regexp_parser (1.7.1) + regexp_parser (1.8.2) rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (0.89.1) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + rubocop (1.3.1) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.3.0, < 1.0) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.3.0) - parser (>= 2.7.1.4) - rubocop-packaging (0.4.0) - rubocop (~> 0.89) - rubocop-rails (2.4.1) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + rubocop-packaging (0.5.1) + rubocop (>= 0.89, < 2.0) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) + rubocop (>= 0.87.0) ruby-progressbar (1.10.1) - ruby_dep (1.5.0) - rubyzip (2.0.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - selenium-webdriver (3.142.6) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - shoulda-context (1.2.2) - spring (2.1.0) + shoulda-context (2.0.0) + spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.2) + sprockets (4.0.2) 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) + sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.6) + tzinfo (1.2.8) thread_safe (~> 0.1) unicode-display_width (1.7.0) warnings_logger (0.1.1) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.20) + yard (0.9.25) zeus (0.15.14) method_source (>= 0.6.7) @@ -229,38 +229,37 @@ PLATFORMS ruby DEPENDENCIES - appraisal (= 2.2.0) - bcrypt (~> 3.1.7) - bundler (~> 1.1) - capybara (~> 2.13) + appraisal + bcrypt (~> 3.1.16) + capybara (~> 3.33) fssm - jbuilder (~> 2.5) - listen (>= 3.0.5, < 3.2) + jbuilder (~> 2.10) + listen (~> 3.3) pg (~> 0.18) pry pry-byebug - puma (~> 3.7) + puma (~> 5.0) rails (= 5.1.7) rails-controller-testing (>= 1.0.1) - rake (= 13.0.1) + rake redcarpet rouge - rspec (~> 3.9) - rspec-rails (~> 3.9) + rspec + rspec-rails (~> 4.0) rubocop rubocop-packaging rubocop-rails - sass-rails (~> 5.0) + sass-rails (~> 6.0) selenium-webdriver - shoulda-context (~> 1.2.0) + shoulda-context (~> 2.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) - sqlite3 (~> 1.3.6) + sqlite3 (~> 1.4) turbolinks (~> 5) warnings_logger yard zeus BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/gemfiles/rails_5_2.gemfile b/gemfiles/rails_5_2.gemfile index 70c8dd36b..3f8c2a3e7 100644 --- a/gemfiles/rails_5_2.gemfile +++ b/gemfiles/rails_5_2.gemfile @@ -2,12 +2,11 @@ source "https://rubygems.org" -gem "appraisal", "2.2.0" -gem "bundler", "~> 1.1" +gem "appraisal" gem "pry" gem "pry-byebug" -gem "rake", "13.0.1" -gem "rspec", "~> 3.9" +gem "rake" +gem "rspec" gem "rubocop", require: false gem "rubocop-packaging", require: false gem "rubocop-rails", require: false @@ -19,20 +18,20 @@ gem "rouge" gem "yard" gem "spring" gem "spring-commands-rspec" -gem "rspec-rails", "~> 3.9" -gem "shoulda-context", "~> 1.2.0" gem "rails-controller-testing", ">= 1.0.1" +gem "rspec-rails", "~> 4.0" +gem "shoulda-context", "~> 2.0" gem "rails", "5.2.4.1" -gem "puma", "~> 3.11" -gem "bootsnap", ">= 1.1.0", require: false -gem "sass-rails", "~> 5.0" +gem "puma", "~> 5.0" +gem "bootsnap", ">= 1.5.0", require: false +gem "sass-rails", "~> 6.0" gem "turbolinks", "~> 5" -gem "jbuilder", "~> 2.5" -gem "bcrypt", "~> 3.1.7" -gem "capybara", "~> 3.1.1" +gem "jbuilder", "~> 2.10" +gem "bcrypt", "~> 3.1.16" +gem "capybara", "~> 3.33" gem "selenium-webdriver" gem "chromedriver-helper" -gem "listen", ">= 3.0.5", "< 3.2" +gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" -gem "pg", "~> 0.18" -gem "sqlite3", "~> 1.3.6" +gem "pg", ">= 0.18", "< 2.0" +gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails_5_2.gemfile.lock b/gemfiles/rails_5_2.gemfile.lock index 010b51ec5..0d19f45f9 100644 --- a/gemfiles/rails_5_2.gemfile.lock +++ b/gemfiles/rails_5_2.gemfile.lock @@ -44,7 +44,7 @@ GEM tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - appraisal (2.2.0) + appraisal (2.3.0) bundler rake thor (>= 0.14.0) @@ -52,41 +52,41 @@ GEM io-like (~> 0.3.0) arel (9.0.0) ast (2.4.1) - bcrypt (3.1.13) - bootsnap (1.4.5) + bcrypt (3.1.16) + bootsnap (1.5.1) msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) - capybara (3.1.1) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) rack (>= 1.6.0) rack-test (>= 0.6.3) - xpath (~> 3.0) + regexp_parser (~> 1.5) + xpath (~> 3.2) childprocess (3.0.0) chromedriver-helper (2.1.1) archive-zip (~> 0.10) nokogiri (~> 1.8) coderay (1.1.3) - concurrent-ruby (1.1.5) - crass (1.0.5) - diff-lcs (1.3) - erubi (1.9.0) - ffi (1.11.3) + concurrent-ruby (1.1.7) + crass (1.0.6) + diff-lcs (1.4.4) + erubi (1.10.0) + ffi (1.13.1) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.7.0) + i18n (1.8.5) concurrent-ruby (~> 1.0) - io-like (0.3.0) - jbuilder (2.9.1) - activesupport (>= 4.2.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.4.0) + io-like (0.3.1) + jbuilder (2.10.1) + activesupport (>= 5.0.0) + listen (3.3.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -94,27 +94,28 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) - mimemagic (0.3.3) + mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) - nio4r (2.5.2) - nokogiri (1.10.7) + minitest (5.14.2) + msgpack (1.3.3) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - parallel (1.19.2) - parser (2.7.1.4) + parallel (1.20.0) + parser (2.7.2.0) ast (~> 2.4.1) - pg (0.21.0) + pg (1.2.3) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - public_suffix (4.0.1) - puma (3.12.2) - rack (2.2.2) + public_suffix (4.0.6) + puma (5.0.4) + nio4r (~> 2.0) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) rails (5.2.4.1) @@ -130,10 +131,10 @@ GEM bundler (>= 1.3.0) railties (= 5.2.4.1) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) @@ -147,98 +148,97 @@ GEM thor (>= 0.19.0, < 2.0) rainbow (3.0.0) rake (13.0.1) - rb-fsevent (0.10.3) + rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.0) - regexp_parser (1.7.1) + regexp_parser (1.8.2) rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (0.89.1) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + rubocop (1.3.1) parallel (~> 1.10) - parser (>= 2.7.1.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.7) + regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.3.0, < 1.0) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.3.0) - parser (>= 2.7.1.4) - rubocop-packaging (0.4.0) - rubocop (~> 0.89) - rubocop-rails (2.4.1) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + rubocop-packaging (0.5.1) + rubocop (>= 0.89, < 2.0) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) + rubocop (>= 0.87.0) ruby-progressbar (1.10.1) - ruby_dep (1.5.0) - rubyzip (2.0.0) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.1.0) - railties (>= 5.2.0) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) - selenium-webdriver (3.142.6) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - shoulda-context (1.2.2) - spring (2.1.0) + shoulda-context (2.0.0) + spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.2) + sprockets (4.0.2) 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) + sqlite3 (1.4.2) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.6) + tzinfo (1.2.8) thread_safe (~> 0.1) unicode-display_width (1.7.0) warnings_logger (0.1.1) - websocket-driver (0.7.1) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.20) + yard (0.9.25) zeus (0.15.14) method_source (>= 0.6.7) @@ -246,40 +246,39 @@ PLATFORMS ruby DEPENDENCIES - appraisal (= 2.2.0) - bcrypt (~> 3.1.7) - bootsnap (>= 1.1.0) - bundler (~> 1.1) - capybara (~> 3.1.1) + appraisal + bcrypt (~> 3.1.16) + bootsnap (>= 1.5.0) + capybara (~> 3.33) chromedriver-helper fssm - jbuilder (~> 2.5) - listen (>= 3.0.5, < 3.2) - pg (~> 0.18) + jbuilder (~> 2.10) + listen (~> 3.3) + pg (>= 0.18, < 2.0) pry pry-byebug - puma (~> 3.11) + puma (~> 5.0) rails (= 5.2.4.1) rails-controller-testing (>= 1.0.1) - rake (= 13.0.1) + rake redcarpet rouge - rspec (~> 3.9) - rspec-rails (~> 3.9) + rspec + rspec-rails (~> 4.0) rubocop rubocop-packaging rubocop-rails - sass-rails (~> 5.0) + sass-rails (~> 6.0) selenium-webdriver - shoulda-context (~> 1.2.0) + shoulda-context (~> 2.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) - sqlite3 (~> 1.3.6) + sqlite3 (~> 1.4) turbolinks (~> 5) warnings_logger yard zeus BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/gemfiles/rails_6_0.gemfile b/gemfiles/rails_6_0.gemfile index d002b112e..99aa3eed5 100644 --- a/gemfiles/rails_6_0.gemfile +++ b/gemfiles/rails_6_0.gemfile @@ -2,12 +2,11 @@ source "https://rubygems.org" -gem "appraisal", "2.2.0" -gem "bundler", "~> 1.1" +gem "appraisal" gem "pry" gem "pry-byebug" -gem "rake", "13.0.1" -gem "rspec", "~> 3.9" +gem "rake" +gem "rspec" gem "rubocop", require: false gem "rubocop-packaging", require: false gem "rubocop-rails", require: false @@ -19,21 +18,20 @@ gem "rouge" gem "yard" gem "spring" gem "spring-commands-rspec" -gem "rspec-rails", "~> 3.9" -gem "shoulda-context", "~> 1.2.0" gem "rails-controller-testing", ">= 1.0.1" -gem "rails", "6.0.2.1" -gem "puma", "~> 4.1" -gem "bootsnap", ">= 1.4.2", require: false +gem "rspec-rails", "~> 4.0" +gem "shoulda-context", "~> 2.0" +gem "rails", "6.0.3.4" +gem "puma", "~> 5.0" +gem "bootsnap", ">= 1.5.0", require: false gem "sass-rails", ">= 6" gem "turbolinks", "~> 5" -gem "jbuilder", "~> 2.7" -gem "bcrypt", "~> 3.1.7" -gem "capybara", ">= 2.15" -gem "listen", ">= 3.0.5", "< 3.2" +gem "jbuilder", "~> 2.10" +gem "bcrypt", "~> 3.1.16" +gem "capybara", ">= 3.33" +gem "listen", "~> 3.3" gem "spring-watcher-listen", "~> 2.0.0" gem "selenium-webdriver" gem "webdrivers" -gem "actiontext", "~> 6.0.2.1" gem "pg", ">= 0.18", "< 2.0" gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails_6_0.gemfile.lock b/gemfiles/rails_6_0.gemfile.lock index d2ec4547d..b5dfa1747 100644 --- a/gemfiles/rails_6_0.gemfile.lock +++ b/gemfiles/rails_6_0.gemfile.lock @@ -1,74 +1,74 @@ GEM remote: https://rubygems.org/ specs: - actioncable (6.0.2.1) - actionpack (= 6.0.2.1) + actioncable (6.0.3.4) + actionpack (= 6.0.3.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + actionmailbox (6.0.3.4) + actionpack (= 6.0.3.4) + activejob (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) mail (>= 2.7.1) - actionmailer (6.0.2.1) - actionpack (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) + actionmailer (6.0.3.4) + actionpack (= 6.0.3.4) + actionview (= 6.0.3.4) + activejob (= 6.0.3.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (6.0.2.1) - actionview (= 6.0.2.1) - activesupport (= 6.0.2.1) + actionpack (6.0.3.4) + actionview (= 6.0.3.4) + activesupport (= 6.0.3.4) rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (6.0.2.1) - actionpack (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + actiontext (6.0.3.4) + actionpack (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) nokogiri (>= 1.8.5) - actionview (6.0.2.1) - activesupport (= 6.0.2.1) + actionview (6.0.3.4) + activesupport (= 6.0.3.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (6.0.2.1) - activesupport (= 6.0.2.1) + activejob (6.0.3.4) + activesupport (= 6.0.3.4) globalid (>= 0.3.6) - activemodel (6.0.2.1) - activesupport (= 6.0.2.1) - activerecord (6.0.2.1) - activemodel (= 6.0.2.1) - activesupport (= 6.0.2.1) - activestorage (6.0.2.1) - actionpack (= 6.0.2.1) - activejob (= 6.0.2.1) - activerecord (= 6.0.2.1) + activemodel (6.0.3.4) + activesupport (= 6.0.3.4) + activerecord (6.0.3.4) + activemodel (= 6.0.3.4) + activesupport (= 6.0.3.4) + activestorage (6.0.3.4) + actionpack (= 6.0.3.4) + activejob (= 6.0.3.4) + activerecord (= 6.0.3.4) marcel (~> 0.3.1) - activesupport (6.0.2.1) + activesupport (6.0.3.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - zeitwerk (~> 2.2) + zeitwerk (~> 2.2, >= 2.2.2) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - appraisal (2.2.0) + appraisal (2.3.0) bundler rake thor (>= 0.14.0) ast (2.4.1) - bcrypt (3.1.13) - bootsnap (1.4.5) + bcrypt (3.1.16) + bootsnap (1.5.1) msgpack (~> 1.0) builder (3.2.4) byebug (11.1.3) - capybara (3.30.0) + capybara (3.33.0) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -78,23 +78,22 @@ GEM xpath (~> 3.2) childprocess (3.0.0) coderay (1.1.3) - concurrent-ruby (1.1.5) - crass (1.0.5) - diff-lcs (1.3) - erubi (1.9.0) - ffi (1.11.3) + concurrent-ruby (1.1.7) + crass (1.0.6) + diff-lcs (1.4.4) + erubi (1.10.0) + ffi (1.13.1) fssm (0.2.10) globalid (0.4.2) activesupport (>= 4.2.0) - i18n (1.7.0) + i18n (1.8.5) concurrent-ruby (~> 1.0) - jbuilder (2.9.1) - activesupport (>= 4.2.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.4.0) + jbuilder (2.10.1) + activesupport (>= 5.0.0) + listen (3.3.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.7.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -102,111 +101,112 @@ GEM marcel (0.3.3) mimemagic (~> 0.3.2) method_source (1.0.0) - mimemagic (0.3.3) + mimemagic (0.3.5) mini_mime (1.0.2) mini_portile2 (2.4.0) - minitest (5.13.0) - msgpack (1.3.1) - nio4r (2.5.2) - nokogiri (1.10.7) + minitest (5.14.2) + msgpack (1.3.3) + nio4r (2.5.4) + nokogiri (1.10.10) mini_portile2 (~> 2.4.0) - parallel (1.19.2) - parser (2.7.1.4) + parallel (1.20.0) + parser (2.7.2.0) ast (~> 2.4.1) - pg (1.2.0) + pg (1.2.3) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.9.0) byebug (~> 11.0) pry (~> 0.13.0) - public_suffix (4.0.1) - puma (4.3.1) + public_suffix (4.0.6) + puma (5.0.4) nio4r (~> 2.0) - rack (2.2.2) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (6.0.2.1) - actioncable (= 6.0.2.1) - actionmailbox (= 6.0.2.1) - actionmailer (= 6.0.2.1) - actionpack (= 6.0.2.1) - actiontext (= 6.0.2.1) - actionview (= 6.0.2.1) - activejob (= 6.0.2.1) - activemodel (= 6.0.2.1) - activerecord (= 6.0.2.1) - activestorage (= 6.0.2.1) - activesupport (= 6.0.2.1) + rails (6.0.3.4) + actioncable (= 6.0.3.4) + actionmailbox (= 6.0.3.4) + actionmailer (= 6.0.3.4) + actionpack (= 6.0.3.4) + actiontext (= 6.0.3.4) + actionview (= 6.0.3.4) + activejob (= 6.0.3.4) + activemodel (= 6.0.3.4) + activerecord (= 6.0.3.4) + activestorage (= 6.0.3.4) + activesupport (= 6.0.3.4) bundler (>= 1.3.0) - railties (= 6.0.2.1) + railties (= 6.0.3.4) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.4) - actionpack (>= 5.0.1.x) - actionview (>= 5.0.1.x) - activesupport (>= 5.0.1.x) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (6.0.2.1) - actionpack (= 6.0.2.1) - activesupport (= 6.0.2.1) + railties (6.0.3.4) + actionpack (= 6.0.3.4) + activesupport (= 6.0.3.4) method_source rake (>= 0.8.7) thor (>= 0.20.3, < 2.0) rainbow (3.0.0) rake (13.0.1) - rb-fsevent (0.10.3) + rb-fsevent (0.10.4) rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.0) - regexp_parser (1.6.0) + regexp_parser (1.8.2) rexml (3.2.4) - rouge (3.22.0) - rspec (3.9.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-core (3.9.0) - rspec-support (~> 3.9.0) - rspec-expectations (3.9.0) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-mocks (3.9.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.9.0) - rspec-rails (3.9.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.9.0) - rspec-expectations (~> 3.9.0) - rspec-mocks (~> 3.9.0) - rspec-support (~> 3.9.0) - rspec-support (3.9.0) - rubocop (0.84.0) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + rubocop (1.3.1) parallel (~> 1.10) - parser (>= 2.7.0.1) + parser (>= 2.7.1.5) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8) rexml - rubocop-ast (>= 0.0.3) + rubocop-ast (>= 1.1.1) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 2.0) - rubocop-ast (0.3.0) - parser (>= 2.7.1.4) - rubocop-packaging (0.1.1) - rubocop (>= 0.75.0) - rubocop-rails (2.4.1) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + rubocop-packaging (0.5.1) + rubocop (>= 0.89, < 2.0) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 0.72.0) + rubocop (>= 0.87.0) ruby-progressbar (1.10.1) - ruby_dep (1.5.0) - rubyzip (2.0.0) + rubyzip (2.3.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) - sassc (2.2.1) + sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -214,20 +214,20 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.6) + selenium-webdriver (3.142.7) childprocess (>= 0.5, < 4.0) rubyzip (>= 1.2.2) - shoulda-context (1.2.2) - spring (2.1.0) + shoulda-context (2.0.0) + spring (2.1.1) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (4.0.0) + sprockets (4.0.2) 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) @@ -238,21 +238,21 @@ GEM turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.6) + tzinfo (1.2.8) thread_safe (~> 0.1) unicode-display_width (1.7.0) warnings_logger (0.1.1) - webdrivers (4.1.3) + webdrivers (4.4.1) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (>= 3.0, < 4.0) - websocket-driver (0.7.1) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) + websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - yard (0.9.20) - zeitwerk (2.2.2) + yard (0.9.25) + zeitwerk (2.4.1) zeus (0.15.14) method_source (>= 0.6.7) @@ -260,32 +260,30 @@ PLATFORMS ruby DEPENDENCIES - actiontext (~> 6.0.2.1) - appraisal (= 2.2.0) - bcrypt (~> 3.1.7) - bootsnap (>= 1.4.2) - bundler (~> 1.1) - capybara (>= 2.15) + appraisal + bcrypt (~> 3.1.16) + bootsnap (>= 1.5.0) + capybara (>= 3.33) fssm - jbuilder (~> 2.7) - listen (>= 3.0.5, < 3.2) + jbuilder (~> 2.10) + listen (~> 3.3) pg (>= 0.18, < 2.0) pry pry-byebug - puma (~> 4.1) - rails (= 6.0.2.1) + puma (~> 5.0) + rails (= 6.0.3.4) rails-controller-testing (>= 1.0.1) - rake (= 13.0.1) + rake redcarpet rouge - rspec (~> 3.9) - rspec-rails (~> 3.9) + rspec + rspec-rails (~> 4.0) rubocop rubocop-packaging rubocop-rails sass-rails (>= 6) selenium-webdriver - shoulda-context (~> 1.2.0) + shoulda-context (~> 2.0) spring spring-commands-rspec spring-watcher-listen (~> 2.0.0) @@ -297,4 +295,4 @@ DEPENDENCIES zeus BUNDLED WITH - 1.17.3 + 2.1.4 diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile new file mode 100644 index 000000000..7ac484c8b --- /dev/null +++ b/gemfiles/rails_6_1.gemfile @@ -0,0 +1,37 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "appraisal" +gem "pry" +gem "pry-byebug" +gem "rake" +gem "rspec" +gem "rubocop", require: false +gem "rubocop-packaging", require: false +gem "rubocop-rails", require: false +gem "warnings_logger" +gem "zeus", require: false +gem "fssm" +gem "redcarpet" +gem "rouge" +gem "yard" +gem "spring" +gem "spring-commands-rspec" +gem "rails-controller-testing", ">= 1.0.1" +gem "rspec-rails", "~> 4.0" +gem "shoulda-context", "~> 2.0" +gem "rails", "6.1.0.rc1" +gem "puma", "~> 5.0" +gem "bootsnap", ">= 1.5.0", require: false +gem "sass-rails", ">= 6" +gem "turbolinks", "~> 5" +gem "jbuilder", "~> 2.10" +gem "bcrypt", "~> 3.1.16" +gem "capybara", ">= 3.33" +gem "listen", "~> 3.3" +gem "spring-watcher-listen", "~> 2.0.0" +gem "selenium-webdriver" +gem "webdrivers" +gem "pg", ">= 0.18", "< 2.0" +gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails_6_1.gemfile.lock b/gemfiles/rails_6_1.gemfile.lock new file mode 100644 index 000000000..81125f6ed --- /dev/null +++ b/gemfiles/rails_6_1.gemfile.lock @@ -0,0 +1,301 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + activejob (= 6.1.0.rc1) + activerecord (= 6.1.0.rc1) + activestorage (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + mail (>= 2.7.1) + actionmailer (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + actionview (= 6.1.0.rc1) + activejob (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.1.0.rc1) + actionview (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + rack (~> 2.0, >= 2.0.9) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + activerecord (= 6.1.0.rc1) + activestorage (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + nokogiri (>= 1.8.5) + actionview (6.1.0.rc1) + activesupport (= 6.1.0.rc1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.1.0.rc1) + activesupport (= 6.1.0.rc1) + globalid (>= 0.3.6) + activemodel (6.1.0.rc1) + activesupport (= 6.1.0.rc1) + activerecord (6.1.0.rc1) + activemodel (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + activestorage (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + activejob (= 6.1.0.rc1) + activerecord (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + marcel (~> 0.3.1) + mimemagic (~> 0.3.2) + activesupport (6.1.0.rc1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.3.0) + bundler + rake + thor (>= 0.14.0) + ast (2.4.1) + bcrypt (3.1.16) + bootsnap (1.5.1) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.1.3) + capybara (3.33.0) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + childprocess (3.0.0) + coderay (1.1.3) + concurrent-ruby (1.1.7) + crass (1.0.6) + diff-lcs (1.4.4) + erubi (1.10.0) + ffi (1.13.1) + fssm (0.2.10) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.5) + concurrent-ruby (~> 1.0) + jbuilder (2.10.1) + activesupport (>= 5.0.0) + listen (3.3.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.7.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.5) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.2) + msgpack (1.3.3) + nio4r (2.5.4) + nokogiri (1.10.10) + mini_portile2 (~> 2.4.0) + parallel (1.20.0) + parser (2.7.2.0) + ast (~> 2.4.1) + pg (1.2.3) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + pry-byebug (3.9.0) + byebug (~> 11.0) + pry (~> 0.13.0) + public_suffix (4.0.6) + puma (5.0.4) + nio4r (~> 2.0) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.1.0.rc1) + actioncable (= 6.1.0.rc1) + actionmailbox (= 6.1.0.rc1) + actionmailer (= 6.1.0.rc1) + actionpack (= 6.1.0.rc1) + actiontext (= 6.1.0.rc1) + actionview (= 6.1.0.rc1) + activejob (= 6.1.0.rc1) + activemodel (= 6.1.0.rc1) + activerecord (= 6.1.0.rc1) + activestorage (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + bundler (>= 1.15.0) + railties (= 6.1.0.rc1) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.1.0.rc1) + actionpack (= 6.1.0.rc1) + activesupport (= 6.1.0.rc1) + method_source + rake (>= 0.8.7) + thor (~> 1.0) + rainbow (3.0.0) + rake (13.0.1) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) + ffi (~> 1.0) + redcarpet (3.5.0) + regexp_parser (1.8.2) + rexml (3.2.4) + rouge (3.25.0) + rspec (3.10.0) + rspec-core (~> 3.10.0) + rspec-expectations (~> 3.10.0) + rspec-mocks (~> 3.10.0) + rspec-core (3.10.0) + rspec-support (~> 3.10.0) + rspec-expectations (3.10.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-mocks (3.10.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.10.0) + rspec-rails (4.0.1) + actionpack (>= 4.2) + activesupport (>= 4.2) + railties (>= 4.2) + rspec-core (~> 3.9) + rspec-expectations (~> 3.9) + rspec-mocks (~> 3.9) + rspec-support (~> 3.9) + rspec-support (3.10.0) + rubocop (1.3.1) + parallel (~> 1.10) + parser (>= 2.7.1.5) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8) + rexml + rubocop-ast (>= 1.1.1) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (1.1.1) + parser (>= 2.7.1.5) + rubocop-packaging (0.5.1) + rubocop (>= 0.89, < 2.0) + rubocop-rails (2.8.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 0.87.0) + ruby-progressbar (1.10.1) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + shoulda-context (2.0.0) + spring (2.1.1) + spring-commands-rspec (1.0.4) + spring (>= 0.9.1) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (4.0.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.2) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.0.1) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + tzinfo (2.0.3) + concurrent-ruby (~> 1.0) + unicode-display_width (1.7.0) + warnings_logger (0.1.1) + webdrivers (4.4.1) + nokogiri (~> 1.6) + rubyzip (>= 1.3.0) + selenium-webdriver (>= 3.0, < 4.0) + websocket-driver (0.7.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + yard (0.9.25) + zeitwerk (2.4.1) + zeus (0.15.14) + method_source (>= 0.6.7) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + bcrypt (~> 3.1.16) + bootsnap (>= 1.5.0) + capybara (>= 3.33) + fssm + jbuilder (~> 2.10) + listen (~> 3.3) + pg (>= 0.18, < 2.0) + pry + pry-byebug + puma (~> 5.0) + rails (= 6.1.0.rc1) + rails-controller-testing (>= 1.0.1) + rake + redcarpet + rouge + rspec + rspec-rails (~> 4.0) + rubocop + rubocop-packaging + rubocop-rails + sass-rails (>= 6) + selenium-webdriver + shoulda-context (~> 2.0) + spring + spring-commands-rspec + spring-watcher-listen (~> 2.0.0) + sqlite3 (~> 1.4) + turbolinks (~> 5) + warnings_logger + webdrivers + yard + zeus + +BUNDLED WITH + 2.1.4 diff --git a/lib/shoulda/matchers/action_controller/callback_matcher.rb b/lib/shoulda/matchers/action_controller/callback_matcher.rb index 6c5cf1edb..16e2bad39 100644 --- a/lib/shoulda/matchers/action_controller/callback_matcher.rb +++ b/lib/shoulda/matchers/action_controller/callback_matcher.rb @@ -1,64 +1,6 @@ module Shoulda module Matchers module ActionController - # The `use_before_filter` matcher is used to test that a before_filter - # callback is defined within your controller. - # - # class UsersController < ApplicationController - # before_filter :authenticate_user! - # end - # - # # RSpec - # RSpec.describe UsersController, type: :controller do - # it { should use_before_filter(:authenticate_user!) } - # it { should_not use_before_filter(:prevent_ssl) } - # end - # - # # Minitest (Shoulda) - # class UsersControllerTest < ActionController::TestCase - # should use_before_filter(:authenticate_user!) - # should_not use_before_filter(:prevent_ssl) - # end - # - # @note This method is only available when using shoulda-matchers under - # Rails 4.x. - # @return [CallbackMatcher] - # - if RailsShim.action_pack_lt_5? - def use_before_filter(callback) - CallbackMatcher.new(callback, :before, :filter) - end - end - - # The `use_after_filter` matcher is used to test that an after_filter - # callback is defined within your controller. - # - # class IssuesController < ApplicationController - # after_filter :log_activity - # end - # - # # RSpec - # RSpec.describe IssuesController, type: :controller do - # it { should use_after_filter(:log_activity) } - # it { should_not use_after_filter(:destroy_user) } - # end - # - # # Minitest (Shoulda) - # class IssuesControllerTest < ActionController::TestCase - # should use_after_filter(:log_activity) - # should_not use_after_filter(:destroy_user) - # end - # - # @note This method is only available when using shoulda-matchers under - # Rails 4.x. - # @return [CallbackMatcher] - # - if RailsShim.action_pack_lt_5? - def use_after_filter(callback) - CallbackMatcher.new(callback, :after, :filter) - end - end - # The `use_before_action` matcher is used to test that a before_action # callback is defined within your controller. # @@ -109,35 +51,6 @@ def use_after_action(callback) CallbackMatcher.new(callback, :after, :action) end - # The `use_around_filter` matcher is used to test that an around_filter - # callback is defined within your controller. - # - # class ChangesController < ApplicationController - # around_filter :wrap_in_transaction - # end - # - # # RSpec - # RSpec.describe ChangesController, type: :controller do - # it { should use_around_filter(:wrap_in_transaction) } - # it { should_not use_around_filter(:save_view_context) } - # end - # - # # Minitest (Shoulda) - # class ChangesControllerTest < ActionController::TestCase - # should use_around_filter(:wrap_in_transaction) - # should_not use_around_filter(:save_view_context) - # end - # - # @note This method is only available when using shoulda-matchers under - # Rails 4.x. - # @return [CallbackMatcher] - # - if RailsShim.action_pack_lt_5? - def use_around_filter(callback) - CallbackMatcher.new(callback, :around, :filter) - end - end - # The `use_around_action` matcher is used to test that an around_action # callback is defined within your controller. # diff --git a/lib/shoulda/matchers/active_model.rb b/lib/shoulda/matchers/active_model.rb index cab68545d..e4a0ad7bb 100644 --- a/lib/shoulda/matchers/active_model.rb +++ b/lib/shoulda/matchers/active_model.rb @@ -26,7 +26,6 @@ require 'shoulda/matchers/active_model/numericality_matchers/odd_number_matcher' require 'shoulda/matchers/active_model/numericality_matchers/even_number_matcher' require 'shoulda/matchers/active_model/numericality_matchers/only_integer_matcher' -require 'shoulda/matchers/active_model/allow_mass_assignment_of_matcher' require 'shoulda/matchers/active_model/errors' require 'shoulda/matchers/active_model/have_secure_password_matcher' diff --git a/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb b/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb deleted file mode 100644 index 4cf75f10d..000000000 --- a/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +++ /dev/null @@ -1,161 +0,0 @@ -module Shoulda - module Matchers - module ActiveModel - # The `allow_mass_assignment_of` matcher tests usage of Rails 3's - # `attr_accessible` and `attr_protected` macros, asserting that an - # attribute in your model is contained in either the whitelist or - # blacklist and thus can or cannot be set via mass assignment. - # - # class Post - # include ActiveModel::Model - # include ActiveModel::MassAssignmentSecurity - # attr_accessor :title - # - # attr_accessible :title - # end - # - # class User - # include ActiveModel::Model - # include ActiveModel::MassAssignmentSecurity - # attr_accessor :encrypted_password - # - # attr_protected :encrypted_password - # end - # - # # RSpec - # RSpec.describe Post, type: :model do - # it { should allow_mass_assignment_of(:title) } - # end - # - # RSpec.describe User, type: :model do - # it { should_not allow_mass_assignment_of(:encrypted_password) } - # end - # - # # Minitest (Shoulda) - # class PostTest < ActiveSupport::TestCase - # should allow_mass_assignment_of(:title) - # end - # - # class UserTest < ActiveSupport::TestCase - # should_not allow_mass_assignment_of(:encrypted_password) - # end - # - # #### Optional qualifiers - # - # ##### as - # - # Use `as` if your mass-assignment rules apply only under a certain role - # *(Rails >= 3.1 only)*. - # - # class Post - # include ActiveModel::Model - # include ActiveModel::MassAssignmentSecurity - # attr_accessor :title - # - # attr_accessible :title, as: :admin - # end - # - # # RSpec - # RSpec.describe Post, type: :model do - # it { should allow_mass_assignment_of(:title).as(:admin) } - # end - # - # # Minitest (Shoulda) - # class PostTest < ActiveSupport::TestCase - # should allow_mass_assignment_of(:title).as(:admin) - # end - # - # @return [AllowMassAssignmentOfMatcher] - # - def allow_mass_assignment_of(value) - AllowMassAssignmentOfMatcher.new(value) - end - - # @private - class AllowMassAssignmentOfMatcher - attr_reader :failure_message, :failure_message_when_negated - - def initialize(attribute) - @attribute = attribute.to_s - @options = {} - end - - def as(role) - @options[:role] = role - self - end - - def matches?(subject) - @subject = subject - if attr_mass_assignable? - if whitelisting? - @failure_message_when_negated = "#{@attribute} was made "\ - 'accessible' - elsif protected_attributes.empty? - @failure_message_when_negated = 'no attributes were protected' - else - @failure_message_when_negated = - "#{class_name} is protecting " << - "#{protected_attributes.to_a.to_sentence}, " << - "but not #{@attribute}." - end - true - else - @failure_message = - if whitelisting? - "Expected #{@attribute} to be accessible" - else - "Did not expect #{@attribute} to be protected" - end - false - end - end - - def description - [base_description, role_description].compact.join(' ') - end - - private - - def base_description - "allow mass assignment of #{@attribute}" - end - - def role_description - if role != :default - "as #{role}" - end - end - - def role - @options[:role] || :default - end - - def protected_attributes - @_protected_attributes ||= (@subject.class.protected_attributes || []) - end - - def accessible_attributes - @_accessible_attributes ||= - (@subject.class.accessible_attributes || []) - end - - def whitelisting? - authorizer.is_a?(::ActiveModel::MassAssignmentSecurity::WhiteList) - end - - def attr_mass_assignable? - !authorizer.deny?(@attribute) - end - - def authorizer - @subject.class.active_authorizer[role] - end - - def class_name - @subject.class.name - end - end - end - end -end diff --git a/lib/shoulda/matchers/active_record/association_matcher.rb b/lib/shoulda/matchers/active_record/association_matcher.rb index 851471ca5..0f57846e6 100644 --- a/lib/shoulda/matchers/active_record/association_matcher.rb +++ b/lib/shoulda/matchers/active_record/association_matcher.rb @@ -1004,7 +1004,7 @@ def initialize(macro, name) @submatchers = [] @missing = '' - if macro == :belongs_to && RailsShim.active_record_gte_5? + if macro == :belongs_to required(belongs_to_required_by_default?) end end diff --git a/lib/shoulda/matchers/rails_shim.rb b/lib/shoulda/matchers/rails_shim.rb index b426b575a..3dc51a73e 100644 --- a/lib/shoulda/matchers/rails_shim.rb +++ b/lib/shoulda/matchers/rails_shim.rb @@ -3,14 +3,6 @@ module Matchers # @private module RailsShim # rubocop:disable Metrics/ModuleLength class << self - def action_pack_gte_5? - Gem::Requirement.new('>= 5').satisfied_by?(action_pack_version) - end - - def action_pack_lt_5? - Gem::Requirement.new('< 5').satisfied_by?(action_pack_version) - end - def action_pack_version Gem::Version.new(::ActionPack::VERSION::STRING) rescue NameError @@ -58,14 +50,7 @@ def generate_validation_message( end def make_controller_request(context, verb, action, request_params) - params = - if action_pack_gte_5? - { params: request_params } - else - request_params - end - - context.__send__(verb, action, params) + context.__send__(verb, action, { params: request_params }) end def serialized_attributes_for(model) diff --git a/shoulda-matchers.gemspec b/shoulda-matchers.gemspec index a02bb3877..81aa9d881 100644 --- a/shoulda-matchers.gemspec +++ b/shoulda-matchers.gemspec @@ -36,6 +36,6 @@ Gem::Specification.new do |s| 'shoulda-matchers.gemspec'] s.require_paths = ['lib'] - s.required_ruby_version = '>= 2.4.0' - s.add_dependency('activesupport', '>= 4.2.0') + s.required_ruby_version = '>= 2.5.0' + s.add_dependency('activesupport', '>= 5.0.0') end diff --git a/spec/support/unit/active_record/create_table.rb b/spec/support/unit/active_record/create_table.rb index a80ac444e..da4e585d8 100644 --- a/spec/support/unit/active_record/create_table.rb +++ b/spec/support/unit/active_record/create_table.rb @@ -54,12 +54,6 @@ def call attr_reader :table_name, :columns, :connection, :customizer - delegate( - :active_record_supports_array_columns?, - :active_record_version, - to: UnitTests::ActiveRecordVersions, - ) - delegate( :database_supports_array_columns?, :database_adapter, @@ -100,14 +94,6 @@ def add_column_to_table(table, column_name, column_specification) column_options = column_specification.delete(:options) { {} } if column_options[:array] - if !active_record_supports_array_columns? - raise ArgumentError.new( - 'An array column is being added to a table, but this version '\ - "of ActiveRecord (#{active_record_version}) "\ - 'does not support array columns.', - ) - end - if !database_supports_array_columns? raise ArgumentError.new( 'An array column is being added to a table, but this '\ diff --git a/spec/support/unit/helpers/action_pack_versions.rb b/spec/support/unit/helpers/action_pack_versions.rb index 5e6b77fa8..27206c85a 100644 --- a/spec/support/unit/helpers/action_pack_versions.rb +++ b/spec/support/unit/helpers/action_pack_versions.rb @@ -7,14 +7,6 @@ def self.configure_example_group(example_group) example_group.extend(self) end - def action_pack_gte_5? - action_pack_version >= 5 - end - - def action_pack_lt_5? - action_pack_version < 5 - end - def action_pack_version Tests::Version.new(ActionPack::VERSION::STRING) end diff --git a/spec/support/unit/helpers/active_record_versions.rb b/spec/support/unit/helpers/active_record_versions.rb index ad82aa957..517c92f30 100644 --- a/spec/support/unit/helpers/active_record_versions.rb +++ b/spec/support/unit/helpers/active_record_versions.rb @@ -11,42 +11,6 @@ def active_record_version Tests::Version.new(::ActiveRecord::VERSION::STRING) end - def active_record_enum_supports_prefix_and_suffix? - active_record_version >= 5 - end - - def active_record_supports_has_secure_password? - active_record_version >= 3.1 - end - - def active_record_supports_has_secure_token? - active_record_version >= 5.0 - end - - def active_record_supports_array_columns? - active_record_version > 4.2 - end - - def active_record_supports_relations? - active_record_version >= 4 - end - - def active_record_supports_more_dependent_options? - active_record_version >= 4 - end - - def active_record_uniqueness_supports_array_columns? - active_record_version < 5 - end - - def active_record_supports_optional_for_associations? - active_record_version >= 5 - end - - def active_record_supports_expression_indexes? - active_record_version >= 5 - end - def active_record_supports_active_storage? active_record_version >= 5.2 end diff --git a/spec/support/unit/helpers/rails_versions.rb b/spec/support/unit/helpers/rails_versions.rb index 4e5c492d5..10a0d660d 100644 --- a/spec/support/unit/helpers/rails_versions.rb +++ b/spec/support/unit/helpers/rails_versions.rb @@ -11,10 +11,6 @@ def rails_version Tests::Version.new(Rails::VERSION::STRING) end - def rails_lt_5? - rails_version < 5 - end - def rails_5_x? rails_version =~ '~> 5.0' end diff --git a/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb b/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb index 81b8249be..97f297527 100644 --- a/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb @@ -54,20 +54,6 @@ def add_callback(kind, callback_type, callback) end end - if action_pack_lt_5? - describe '#use_before_filter' do - it_behaves_like 'CallbackMatcher', :before, :filter - end - - describe '#use_after_filter' do - it_behaves_like 'CallbackMatcher', :after, :filter - end - - describe '#use_around_filter' do - it_behaves_like 'CallbackMatcher', :around, :filter - end - end - describe '#use_before_action' do it_behaves_like 'CallbackMatcher', :before, :action end diff --git a/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb b/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb index 14bcc5006..d991fd0c7 100644 --- a/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb @@ -603,10 +603,6 @@ def build_context end def expect_to_have_made_controller_request(context:, verb:, action:, params:) - if action_pack_gte_5? - expect(context).to have_received(verb).with(action, params: params) - else - expect(context).to have_received(verb).with(action, params) - end + expect(context).to have_received(verb).with(action, params: params) end end diff --git a/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb deleted file mode 100644 index e9dbd32d3..000000000 --- a/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +++ /dev/null @@ -1,123 +0,0 @@ -require 'unit_spec_helper' - -describe Shoulda::Matchers::ActiveModel::AllowMassAssignmentOfMatcher, type: :model do - if action_pack_lt_5? - context '#description' do - context 'without a role' do - it 'includes the attribute name' do - expect(described_class.new(:attr).description). - to eq 'allow mass assignment of attr' - end - end - - if active_model_3_1? - context 'with a role' do - it 'includes the attribute name and the role' do - expect(described_class.new(:attr).as(:admin).description). - to eq 'allow mass assignment of attr as admin' - end - end - end - end - - context 'an attribute that is blacklisted from mass-assignment' do - it 'rejects being mass-assignable' do - model = define_model(:example, blacklisted: :string) do - attr_protected :blacklisted - end.new - - expect(model).not_to allow_mass_assignment_of(:blacklisted) - end - end - - context 'an attribute that is not whitelisted for mass-assignment' do - it 'rejects being mass-assignable' do - model = define_model( - :example, - not_whitelisted: :string, - whitelisted: :string, - ) do - attr_accessible :whitelisted - end.new - - expect(model).not_to allow_mass_assignment_of(:not_whitelisted) - end - end - - context 'an attribute that is whitelisted for mass-assignment' do - it 'accepts being mass-assignable' do - expect(define_model(:example, whitelisted: :string) do - attr_accessible :whitelisted - end.new).to allow_mass_assignment_of(:whitelisted) - end - end - - context 'an attribute not included in the mass-assignment blacklist' do - it 'accepts being mass-assignable' do - model = define_model( - :example, - not_blacklisted: :string, - blacklisted: :string, - ) do - attr_protected :blacklisted - end.new - - expect(model).to allow_mass_assignment_of(:not_blacklisted) - end - end - - unless active_model_3_2? || active_model_4_0? - context 'an attribute on a class with no protected attributes' do - it 'accepts being mass-assignable' do - expect(no_protected_attributes).to allow_mass_assignment_of(:attr) - end - - it 'assigns a negative failure message' do - matcher = allow_mass_assignment_of(:attr) - - expect(matcher.matches?(no_protected_attributes)).to eq true - - expect(matcher.failure_message_when_negated).not_to be_nil - end - end - - def no_protected_attributes - define_model(:example, attr: :string).new - end - end - - context 'an attribute on a class with all protected attributes' do - it 'rejects being mass-assignable' do - expect(all_protected_attributes).not_to allow_mass_assignment_of(:attr) - end - - def all_protected_attributes - define_model(:example, attr: :string) do - attr_accessible nil - end.new - end - end - - if active_model_3_1? - context 'an attribute included in the mass-assignment whitelist for admin role only' do - it 'rejects being mass-assignable' do - expect(mass_assignable_as_admin).not_to allow_mass_assignment_of(:attr) - end - - it 'accepts being mass-assignable for admin' do - expect(mass_assignable_as_admin).to allow_mass_assignment_of(:attr).as(:admin) - end - - def mass_assignable_as_admin - define_model(:example, attr: :string) do - attr_accessible :attr, as: :admin - end.new - end - end - end - - def define_model(name, columns, &block) - super(name, columns, whitelist_attributes: false, &block) - end - end -end diff --git a/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb index dccca62ac..2d856e4b7 100644 --- a/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb @@ -502,7 +502,6 @@ def model_creator end context 'against a belongs_to association' do - if active_record_supports_optional_for_associations? context 'declared with optional: true' do context 'and an explicit presence validation is on the association' do it 'matches' do @@ -767,93 +766,6 @@ def model_creator end end end - else - context 'declared with required: true' do - context 'and an explicit presence validation is on the association' do - it 'matches' do - record = record_belonging_to( - :parent, - required: true, - validate_presence: true, - ) - - expect { validate_presence_of(:parent) }.to match_against(record) - end - end - - context 'and an explicit presence validation is not on the association' do - it 'still matches' do - record = record_belonging_to( - :parent, - required: true, - validate_presence: false, - ) - - expect { validate_presence_of(:parent) }.to match_against(record) - end - end - end - - context 'declared with required: false' do - context 'and an explicit presence validation is on the association' do - it 'matches' do - record = record_belonging_to( - :parent, - required: false, - validate_presence: true, - ) - - expect { validate_presence_of(:parent) }.to match_against(record) - end - end - - context 'and an explicit presence validation is not on the association' do - it 'does not match' do - record = record_belonging_to( - :parent, - required: false, - validate_presence: false, - model_name: 'Child', - parent_model_name: 'Parent', - ) - - expect { validate_presence_of(:parent) }. - not_to match_against(record). - and_fail_with(<<-MESSAGE) -Expected Child to validate that :parent cannot be empty/falsy, but this -could not be proved. - After setting :parent to ‹nil›, the matcher expected the Child to be - invalid, but it was valid instead. - MESSAGE - end - end - end - - context 'not declared with a required option' do - context 'and an explicit presence validation is on the association' do - it 'matches' do - record = record_belonging_to(:parent, validate_presence: true) - - expect { validate_presence_of(:parent) }.to match_against(record) - end - end - - context 'and an explicit presence validation is not on the association' do - it 'does not match' do - record = record_belonging_to(:parent, validate_presence: false) - - expect { validate_presence_of(:parent) }. - not_to match_against(record). - and_fail_with(<<-MESSAGE) -Expected Child to validate that :parent cannot be empty/falsy, but this -could not be proved. - After setting :parent to ‹nil›, the matcher expected the Child to be - invalid, but it was valid instead. - MESSAGE - end - end - end - end def record_belonging_to( attribute_name, diff --git a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb index 5fe336a70..97106714d 100644 --- a/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb @@ -283,281 +283,188 @@ context 'given the association is neither configured to be required nor optional' do context 'when qualified with required(true)' do - if active_record_supports_optional_for_associations? - context 'when belongs_to is configured to be required by default' do - it 'passes' do - with_belongs_to_as_required_by_default do - expect(belonging_to_parent).to belong_to(:parent).required(true) - end + context 'when belongs_to is configured to be required by default' do + it 'passes' do + with_belongs_to_as_required_by_default do + expect(belonging_to_parent).to belong_to(:parent).required(true) end end + end - context 'when belongs_to is not configured to be required by default' do - it 'fails with an appropriate message' do - with_belongs_to_as_optional_by_default do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).required(true) - end - - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; - i.e., either the association should have been defined with - `required: true`, or there should be a presence validation on - :parent) - MESSAGE - - expect(&assertion).to fail_with_message(message) - end - end - end - else + context 'when belongs_to is not configured to be required by default' do it 'fails with an appropriate message' do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).required(true) - end + with_belongs_to_as_optional_by_default do + assertion = lambda do + expect(belonging_to_parent). + to belong_to(:parent).required(true) + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `required: - true`, or there should be a presence validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is unset; + i.e., either the association should have been defined with + `required: true`, or there should be a presence validation on + :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) + expect(&assertion).to fail_with_message(message) + end end end end context 'when qualified with required(false)' do - if active_record_supports_optional_for_associations? - context 'when belongs_to is configured to be required by default' do - it 'fails with an appropriate message' do - with_belongs_to_as_required_by_default do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).required(false) - end + context 'when belongs_to is configured to be required by default' do + it 'fails with an appropriate message' do + with_belongs_to_as_required_by_default do + assertion = lambda do + expect(belonging_to_parent). + to belong_to(:parent).required(false) + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record not to fail validation if :parent is - unset; i.e., either the association should have been defined - with `required: false`, or there should not be a presence - validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record not to fail validation if :parent is + unset; i.e., either the association should have been defined + with `required: false`, or there should not be a presence + validation on :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) - end + expect(&assertion).to fail_with_message(message) end end + end - context 'when belongs_to is not configured to be required by default' do - it 'passes' do - with_belongs_to_as_optional_by_default do - expect(belonging_to_parent).to belong_to(:parent).required(false) - end - end - end - else + context 'when belongs_to is not configured to be required by default' do it 'passes' do - expect(belonging_to_parent).to belong_to(:parent).required(false) + with_belongs_to_as_optional_by_default do + expect(belonging_to_parent).to belong_to(:parent).required(false) + end end end + end context 'when qualified with optional(true)' do - if active_record_supports_optional_for_associations? - context 'when belongs_to is configured to be required by default' do - it 'fails with an appropriate message' do - with_belongs_to_as_required_by_default do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).optional(true) - end + context 'when belongs_to is configured to be required by default' do + it 'fails with an appropriate message' do + with_belongs_to_as_required_by_default do + assertion = lambda do + expect(belonging_to_parent). + to belong_to(:parent).optional(true) + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record not to fail validation if :parent is - unset; i.e., either the association should have been defined - with `optional: true`, or there should not be a presence - validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record not to fail validation if :parent is + unset; i.e., either the association should have been defined + with `optional: true`, or there should not be a presence + validation on :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) - end + expect(&assertion).to fail_with_message(message) end end + end - context 'when belongs_to is not configured to be required by default' do - it 'passes' do - with_belongs_to_as_optional_by_default do - expect(belonging_to_parent).to belong_to(:parent).optional(true) - end - end - end - else + context 'when belongs_to is not configured to be required by default' do it 'passes' do - expect(belonging_to_parent).to belong_to(:parent).optional(true) + with_belongs_to_as_optional_by_default do + expect(belonging_to_parent).to belong_to(:parent).optional(true) + end end end end context 'when qualified with optional(false)' do - if active_record_supports_optional_for_associations? - context 'when belongs_to is configured to be required by default' do - it 'passes' do - with_belongs_to_as_required_by_default do - expect(belonging_to_parent).to belong_to(:parent).optional(false) - end + context 'when belongs_to is configured to be required by default' do + it 'passes' do + with_belongs_to_as_required_by_default do + expect(belonging_to_parent).to belong_to(:parent).optional(false) end end + end - context 'when belongs_to is not configured to be required by default' do - it 'fails with an appropriate message' do - with_belongs_to_as_optional_by_default do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).optional(false) - end - - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is - unset; i.e., either the association should have been defined - with `optional: false`, or there should be a presence - validation on :parent) - MESSAGE - - expect(&assertion).to fail_with_message(message) - end - end - end - else + context 'when belongs_to is not configured to be required by default' do it 'fails with an appropriate message' do - assertion = lambda do - expect(belonging_to_parent). - to belong_to(:parent).optional(false) - end + with_belongs_to_as_optional_by_default do + assertion = lambda do + expect(belonging_to_parent). + to belong_to(:parent).optional(false) + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `optional: - false`, or there should be a presence validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is + unset; i.e., either the association should have been defined + with `optional: false`, or there should be a presence + validation on :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) + expect(&assertion).to fail_with_message(message) + end end end end context 'when qualified with nothing' do - if active_record_supports_optional_for_associations? - context 'when belongs_to is configured to be required by default' do - it 'passes' do - with_belongs_to_as_required_by_default do - expect(belonging_to_parent).to belong_to(:parent) - end + context 'when belongs_to is configured to be required by default' do + it 'passes' do + with_belongs_to_as_required_by_default do + expect(belonging_to_parent).to belong_to(:parent) end end + end - context 'when belongs_to is not configured to be required by default' do - it 'passes' do - with_belongs_to_as_optional_by_default do - expect(belonging_to_parent).to belong_to(:parent) - end - end - - context 'and a presence validation is on the attribute instead of using required: true' do - it 'passes' do - with_belongs_to_as_optional_by_default do - record = belonging_to_parent do - validates_presence_of :parent - end - - expect(record).to belong_to(:parent) - end - end - end - - context 'and a presence validation is on the attribute with a condition' do - context 'and the condition is true' do - it 'passes' do - with_belongs_to_as_optional_by_default do - child_model = create_child_model_belonging_to_parent do - attr_accessor :condition - - validates_presence_of :parent, if: :condition - end - - record = child_model.new(condition: true) - - expect(record).to belong_to(:parent) - end - end - end - - context 'and the condition is false' do - it 'passes' do - with_belongs_to_as_optional_by_default do - child_model = create_child_model_belonging_to_parent do - attr_accessor :condition - - validates_presence_of :parent, if: :condition - end - - record = child_model.new(condition: false) - - expect(record).to belong_to(:parent) - end - end - end - end - end - else + context 'when belongs_to is not configured to be required by default' do it 'passes' do - expect(belonging_to_parent).to belong_to(:parent) + with_belongs_to_as_optional_by_default do + expect(belonging_to_parent).to belong_to(:parent) + end end context 'and a presence validation is on the attribute instead of using required: true' do it 'passes' do - record = belonging_to_parent do - validates_presence_of :parent - end + with_belongs_to_as_optional_by_default do + record = belonging_to_parent do + validates_presence_of :parent + end - expect(record).to belong_to(:parent) + expect(record).to belong_to(:parent) + end end end context 'and a presence validation is on the attribute with a condition' do context 'and the condition is true' do it 'passes' do - child_model = create_child_model_belonging_to_parent do - attr_accessor :condition + with_belongs_to_as_optional_by_default do + child_model = create_child_model_belonging_to_parent do + attr_accessor :condition - validates_presence_of :parent, if: :condition - end + validates_presence_of :parent, if: :condition + end - record = child_model.new(condition: true) + record = child_model.new(condition: true) - expect(record).to belong_to(:parent) + expect(record).to belong_to(:parent) + end end end context 'and the condition is false' do it 'passes' do - child_model = create_child_model_belonging_to_parent do - attr_accessor :condition + with_belongs_to_as_optional_by_default do + child_model = create_child_model_belonging_to_parent do + attr_accessor :condition - validates_presence_of :parent, if: :condition - end + validates_presence_of :parent, if: :condition + end - record = child_model.new(condition: false) + record = child_model.new(condition: false) - expect(record).to belong_to(:parent) + expect(record).to belong_to(:parent) + end end end end @@ -624,68 +531,97 @@ end end - if active_record_supports_optional_for_associations? - context 'given the association is configured as optional: true' do - context 'when qualified with required(true)' do - it 'fails with an appropriate message' do - assertion = lambda do - expect(belonging_to_parent(optional: true)). - to belong_to(:parent).required(true) - end + context 'given the association is configured as optional: true' do + context 'when qualified with required(true)' do + it 'fails with an appropriate message' do + assertion = lambda do + expect(belonging_to_parent(optional: true)). + to belong_to(:parent).required(true) + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `required: - true`, or there should be a presence validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is unset; i.e., + either the association should have been defined with `required: + true`, or there should be a presence validation on :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) - end + expect(&assertion).to fail_with_message(message) end + end - context 'when qualified with required(false)' do - it 'passes' do - expect(belonging_to_parent(optional: true)). - to belong_to(:parent).required(false) - end + context 'when qualified with required(false)' do + it 'passes' do + expect(belonging_to_parent(optional: true)). + to belong_to(:parent).required(false) end + end - context 'when qualified with optional(true)' do - it 'passes' do + context 'when qualified with optional(true)' do + it 'passes' do + expect(belonging_to_parent(optional: true)). + to belong_to(:parent).optional(true) + end + end + + context 'when qualified with optional(false)' do + it 'fails with an appropriate message' do + assertion = lambda do expect(belonging_to_parent(optional: true)). - to belong_to(:parent).optional(true) + to belong_to(:parent).optional(false) end - end - context 'when qualified with optional(false)' do - it 'fails with an appropriate message' do - assertion = lambda do - expect(belonging_to_parent(optional: true)). - to belong_to(:parent).optional(false) - end + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is unset; i.e., + either the association should have been defined with `optional: + false`, or there should be a presence validation on :parent) + MESSAGE - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `optional: - false`, or there should be a presence validation on :parent) - MESSAGE + expect(&assertion).to fail_with_message(message) + end + end - expect(&assertion).to fail_with_message(message) + context 'when qualified with nothing' do + it 'fails with an appropriate message' do + assertion = lambda do + expect(belonging_to_parent(optional: true)). + to belong_to(:parent) end + + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is unset; i.e., + either the association should have been defined with `required: + true`, or there should be a presence validation on :parent) + MESSAGE + + expect(&assertion).to fail_with_message(message) end + end + end - context 'when qualified with nothing' do + context 'when the model ensures the association is set' do + context 'and the matcher is not qualified with anything' do + context 'and the matcher is not qualified with without_validating_presence' do it 'fails with an appropriate message' do + model = create_child_model_belonging_to_parent do + before_validation :ensure_parent_is_set + + def ensure_parent_is_set + self.parent = Parent.create + end + end + assertion = lambda do - expect(belonging_to_parent(optional: true)). - to belong_to(:parent) + with_belongs_to_as_required_by_default do + expect(model.new).to belong_to(:parent) + end end message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., + Expected Child to have a belongs_to association called parent (and + for the record to fail validation if :parent is unset; i.e., either the association should have been defined with `required: true`, or there should be a presence validation on :parent) MESSAGE @@ -693,102 +629,69 @@ expect(&assertion).to fail_with_message(message) end end - end - end - - if active_record_supports_optional_for_associations? - context 'when the model ensures the association is set' do - context 'and the matcher is not qualified with anything' do - context 'and the matcher is not qualified with without_validating_presence' do - it 'fails with an appropriate message' do - model = create_child_model_belonging_to_parent do - before_validation :ensure_parent_is_set - def ensure_parent_is_set - self.parent = Parent.create - end - end + context 'and the matcher is qualified with without_validating_presence' do + it 'passes' do + model = create_child_model_belonging_to_parent do + before_validation :ensure_parent_is_set - assertion = lambda do - with_belongs_to_as_required_by_default do - expect(model.new).to belong_to(:parent) - end + def ensure_parent_is_set + self.parent = Parent.create end - - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent (and - for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `required: - true`, or there should be a presence validation on :parent) - MESSAGE - - expect(&assertion).to fail_with_message(message) end - end - - context 'and the matcher is qualified with without_validating_presence' do - it 'passes' do - model = create_child_model_belonging_to_parent do - before_validation :ensure_parent_is_set - def ensure_parent_is_set - self.parent = Parent.create - end - end - - with_belongs_to_as_required_by_default do - expect(model.new). - to belong_to(:parent). - without_validating_presence - end + with_belongs_to_as_required_by_default do + expect(model.new). + to belong_to(:parent). + without_validating_presence end end end + end - context 'and the matcher is qualified with required' do - context 'and the matcher is not qualified with without_validating_presence' do - it 'fails with an appropriate message' do - model = create_child_model_belonging_to_parent do - before_validation :ensure_parent_is_set + context 'and the matcher is qualified with required' do + context 'and the matcher is not qualified with without_validating_presence' do + it 'fails with an appropriate message' do + model = create_child_model_belonging_to_parent do + before_validation :ensure_parent_is_set - def ensure_parent_is_set - self.parent = Parent.create - end + def ensure_parent_is_set + self.parent = Parent.create end + end - assertion = lambda do - with_belongs_to_as_required_by_default do - expect(model.new).to belong_to(:parent).required - end + assertion = lambda do + with_belongs_to_as_required_by_default do + expect(model.new).to belong_to(:parent).required end + end - message = format_message(<<-MESSAGE, one_line: true) - Expected Child to have a belongs_to association called parent - (and for the record to fail validation if :parent is unset; i.e., - either the association should have been defined with `required: - true`, or there should be a presence validation on :parent) - MESSAGE + message = format_message(<<-MESSAGE, one_line: true) + Expected Child to have a belongs_to association called parent + (and for the record to fail validation if :parent is unset; i.e., + either the association should have been defined with `required: + true`, or there should be a presence validation on :parent) + MESSAGE - expect(&assertion).to fail_with_message(message) - end + expect(&assertion).to fail_with_message(message) end + end - context 'and the matcher is also qualified with without_validating_presence' do - it 'passes' do - model = create_child_model_belonging_to_parent do - before_validation :ensure_parent_is_set + context 'and the matcher is also qualified with without_validating_presence' do + it 'passes' do + model = create_child_model_belonging_to_parent do + before_validation :ensure_parent_is_set - def ensure_parent_is_set - self.parent = Parent.create - end + def ensure_parent_is_set + self.parent = Parent.create end + end - with_belongs_to_as_required_by_default do - expect(model.new). - to belong_to(:parent). - required. - without_validating_presence - end + with_belongs_to_as_required_by_default do + expect(model.new). + to belong_to(:parent). + required. + without_validating_presence end end end @@ -1486,12 +1389,10 @@ def having_many_non_existent_class(model_name, assoc_name, options = {}) end end - if active_record_supports_optional_for_associations? - context 'given an association with a matching :required option' do - it 'passes' do - expect(having_one_detail(required: true)). - to have_one(:detail).required - end + context 'given an association with a matching :required option' do + it 'passes' do + expect(having_one_detail(required: true)). + to have_one(:detail).required end end @@ -2158,11 +2059,7 @@ def having_and_belonging_to_many_non_existent_class(model_name, assoc_name, opti def define_association_with_conditions(model, macro, name, conditions, _other_options = {}) args = [] options = {} - if active_record_supports_relations? - args << proc { where(conditions) } - else - options[:conditions] = conditions - end + args << proc { where(conditions) } args << options model.__send__(macro, name, *args) end @@ -2170,20 +2067,12 @@ def define_association_with_conditions(model, macro, name, conditions, _other_op def define_association_with_order(model, macro, name, order, _other_options = {}) args = [] options = {} - if active_record_supports_relations? - args << proc { order(order) } - else - options[:order] = order - end + args << proc { order(order) } args << options model.__send__(macro, name, *args) end def dependent_options - if active_record_supports_more_dependent_options? - [:destroy, :delete, :nullify, :restrict_with_exception, :restrict_with_error] - else - [:destroy, :delete, :nullify, :restrict] - end + [:destroy, :delete, :nullify, :restrict_with_exception, :restrict_with_error] end end diff --git a/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb index b7e631472..0206bdc98 100644 --- a/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb @@ -367,168 +367,167 @@ def self.statuses end end - if active_record_enum_supports_prefix_and_suffix? - context 'qualified with #with_prefix' do - context 'when the prefix is explicit' do - context 'if the attribute was not defined with a prefix' do - it 'rejects with an appropriate failure message' do - record = build_record_with_array_values( - model_name: 'Example', - attribute_name: :attr, - column_type: :integer, - values: [:active, :archived], - ) - - assertion = lambda do - expect(record). - to define_enum_for(:attr). - with_values([:active, :archived]). - with_prefix(:foo) - end - - message = format_message(<<-MESSAGE) - Expected Example to define :attr as an enum backed by an integer, - mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing - accessor methods with "foo_". :attr does map to these values, but - the enum is configured with either a different prefix or no prefix - at all (we can't tell which). - MESSAGE + context 'qualified with #with_prefix' do + context 'when the prefix is explicit' do + context 'if the attribute was not defined with a prefix' do + it 'rejects with an appropriate failure message' do + record = build_record_with_array_values( + model_name: 'Example', + attribute_name: :attr, + column_type: :integer, + values: [:active, :archived], + ) - expect(&assertion).to fail_with_message(message) + assertion = lambda do + expect(record). + to define_enum_for(:attr). + with_values([:active, :archived]). + with_prefix(:foo) end - end - context 'if the attribute was defined with a different prefix' do - it 'rejects with an appropriate failure message' do - record = build_record_with_array_values( - model_name: 'Example', - attribute_name: :attr, - column_type: :integer, - values: [:active, :archived], - prefix: :foo, - ) + message = format_message(<<-MESSAGE) + Expected Example to define :attr as an enum backed by an integer, + mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing + accessor methods with "foo_". :attr does map to these values, but + the enum is configured with either a different prefix or no prefix + at all (we can't tell which). + MESSAGE - assertion = lambda do - expect(record). - to define_enum_for(:attr). - with_values([:active, :archived]). - with_prefix(:bar) - end + expect(&assertion).to fail_with_message(message) + end + end - message = format_message(<<-MESSAGE) - Expected Example to define :attr as an enum backed by an integer, - mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing - accessor methods with "bar_". :attr does map to these values, but - the enum is configured with either a different prefix or no prefix - at all (we can't tell which). - MESSAGE + context 'if the attribute was defined with a different prefix' do + it 'rejects with an appropriate failure message' do + record = build_record_with_array_values( + model_name: 'Example', + attribute_name: :attr, + column_type: :integer, + values: [:active, :archived], + prefix: :foo, + ) - expect(&assertion).to fail_with_message(message) + assertion = lambda do + expect(record). + to define_enum_for(:attr). + with_values([:active, :archived]). + with_prefix(:bar) end - end - context 'if the attribute was defined with the same prefix' do - it 'matches' do - record = build_record_with_array_values( - model_name: 'Example', - attribute_name: :attr, - values: [:active, :archived], - prefix: :foo, - ) + message = format_message(<<-MESSAGE) + Expected Example to define :attr as an enum backed by an integer, + mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing + accessor methods with "bar_". :attr does map to these values, but + the enum is configured with either a different prefix or no prefix + at all (we can't tell which). + MESSAGE - matcher = lambda do - define_enum_for(:attr). - with_values([:active, :archived]). - with_prefix(:foo) - end + expect(&assertion).to fail_with_message(message) + end + end - expect(&matcher). - to match_against(record). - or_fail_with(<<-MESSAGE, wrap: true) - Expected Example not to define :attr as an enum backed by an - integer, mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and - prefixing accessor methods with "foo_", but it did. - MESSAGE - end + context 'if the attribute was defined with the same prefix' do + it 'matches' do + record = build_record_with_array_values( + model_name: 'Example', + attribute_name: :attr, + values: [:active, :archived], + prefix: :foo, + ) - it 'has the right description' do - matcher = define_enum_for(:attr). + matcher = lambda do + define_enum_for(:attr). with_values([:active, :archived]). with_prefix(:foo) - - expect(matcher.description).to eq(<<~MESSAGE.strip) - define :attr as an enum backed by an integer with values ‹[:active, :archived]›, prefix: :foo - MESSAGE end + + expect(&matcher). + to match_against(record). + or_fail_with(<<-MESSAGE, wrap: true) + Expected Example not to define :attr as an enum backed by an + integer, mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and + prefixing accessor methods with "foo_", but it did. + MESSAGE end - end - context 'when the prefix is implicit' do - context 'if the attribute was not defined with a prefix' do - it 'rejects with an appropriate failure message' do - record = build_record_with_array_values( - model_name: 'Example', - attribute_name: :attr, - column_type: :integer, - values: [:active, :archived], - ) + it 'has the right description' do + matcher = define_enum_for(:attr). + with_values([:active, :archived]). + with_prefix(:foo) - assertion = lambda do - expect(record). - to define_enum_for(:attr). - with_values([:active, :archived]). - with_prefix - end + expect(matcher.description).to eq(<<~MESSAGE.strip) + define :attr as an enum backed by an integer with values ‹[:active, :archived]›, prefix: :foo + MESSAGE + end + end + end - message = format_message(<<-MESSAGE) - Expected Example to define :attr as an enum backed by an integer, - mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing - accessor methods with "attr_". :attr does map to these values, but - the enum is configured with either a different prefix or no prefix - at all (we can't tell which). - MESSAGE + context 'when the prefix is implicit' do + context 'if the attribute was not defined with a prefix' do + it 'rejects with an appropriate failure message' do + record = build_record_with_array_values( + model_name: 'Example', + attribute_name: :attr, + column_type: :integer, + values: [:active, :archived], + ) - expect(&assertion).to fail_with_message(message) + assertion = lambda do + expect(record). + to define_enum_for(:attr). + with_values([:active, :archived]). + with_prefix end - end - context 'if the attribute was defined with a prefix' do - it 'matches' do - record = build_record_with_array_values( - model_name: 'Example', - attribute_name: :attr, - values: [:active, :archived], - prefix: true, - ) + message = format_message(<<-MESSAGE) + Expected Example to define :attr as an enum backed by an integer, + mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and prefixing + accessor methods with "attr_". :attr does map to these values, but + the enum is configured with either a different prefix or no prefix + at all (we can't tell which). + MESSAGE - matcher = lambda do - define_enum_for(:attr). - with_values([:active, :archived]). - with_prefix - end + expect(&assertion).to fail_with_message(message) + end + end - expect(&matcher). - to match_against(record). - or_fail_with(<<-MESSAGE, wrap: true) - Expected Example not to define :attr as an enum backed by an - integer, mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and - prefixing accessor methods with "attr_", but it did. - MESSAGE - end + context 'if the attribute was defined with a prefix' do + it 'matches' do + record = build_record_with_array_values( + model_name: 'Example', + attribute_name: :attr, + values: [:active, :archived], + prefix: true, + ) - it 'has the right description' do - matcher = define_enum_for(:attr). + matcher = lambda do + define_enum_for(:attr). with_values([:active, :archived]). with_prefix + end - expect(matcher.description).to eq(<<~MESSAGE.strip) - define :attr as an enum backed by an integer with values ‹[:active, :archived]›, prefix: true + expect(&matcher). + to match_against(record). + or_fail_with(<<-MESSAGE, wrap: true) + Expected Example not to define :attr as an enum backed by an + integer, mapping ‹"active"› to ‹0› and ‹"archived"› to ‹1› and + prefixing accessor methods with "attr_", but it did. MESSAGE - end + end + + it 'has the right description' do + matcher = define_enum_for(:attr). + with_values([:active, :archived]). + with_prefix + + expect(matcher.description).to eq(<<~MESSAGE.strip) + define :attr as an enum backed by an integer with values ‹[:active, :archived]›, prefix: true + MESSAGE end end end + context 'qualified with #with_suffix' do context 'when the suffix is explicit' do context 'if the attribute was not defined with a suffix' do @@ -844,11 +843,7 @@ def build_record_with_enum_attribute( attribute_name => { type: column_type }, ) - if active_record_enum_supports_prefix_and_suffix? - model.enum(attribute_name => values, _prefix: prefix, _suffix: suffix) - else - model.enum(attribute_name => values) - end + model.enum(attribute_name => values, _prefix: prefix, _suffix: suffix) model.new end diff --git a/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb index 7a0ffdea9..a0e72494d 100644 --- a/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb @@ -2,8 +2,7 @@ describe Shoulda::Matchers::ActiveRecord::HaveDbIndexMatcher, type: :model do def self.can_test_expression_indexes? - active_record_supports_expression_indexes? && - database_supports_expression_indexes? + database_supports_expression_indexes? end describe 'the matcher' do diff --git a/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb index c8c1e6fb2..9ee474545 100644 --- a/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/have_secure_token_matcher_spec.rb @@ -2,176 +2,174 @@ describe Shoulda::Matchers::ActiveRecord::HaveSecureTokenMatcher, type: :model do - if active_record_supports_has_secure_token? - describe '#description' do - it 'returns the message including the name of the default column' do - matcher = have_secure_token - expect(matcher.description). - to eq('have :token as a secure token') - end + describe '#description' do + it 'returns the message including the name of the default column' do + matcher = have_secure_token + expect(matcher.description). + to eq('have :token as a secure token') + end + + it 'returns the message including the name of a provided column' do + matcher = have_secure_token(:special_token) + expect(matcher.description). + to eq('have :special_token as a secure token') + end + end - it 'returns the message including the name of a provided column' do - matcher = have_secure_token(:special_token) - expect(matcher.description). - to eq('have :special_token as a secure token') - end + it 'matches when the subject configures has_secure_token with the db' do + create_table(:users) do |t| + t.string :token + t.index :token, unique: true end - it 'matches when the subject configures has_secure_token with the db' do - create_table(:users) do |t| - t.string :token - t.index :token, unique: true - end + valid_model = define_model_class(:User) { has_secure_token } - valid_model = define_model_class(:User) { has_secure_token } + expect(valid_model.new).to have_secure_token + end - expect(valid_model.new).to have_secure_token + it 'matches when the subject configures has_secure_token with the db for ' \ + 'a custom attribute' do + create_table(:users) do |t| + t.string :auth_token + t.index :auth_token, unique: true end - it 'matches when the subject configures has_secure_token with the db for ' \ - 'a custom attribute' do - create_table(:users) do |t| - t.string :auth_token - t.index :auth_token, unique: true - end - - valid_model = define_model_class(:User) { has_secure_token(:auth_token) } - expect(valid_model.new).to have_secure_token(:auth_token) - end - - it 'does not match when missing an token index' do - create_table(:users) do |t| - t.string :token - end + valid_model = define_model_class(:User) { has_secure_token(:auth_token) } + expect(valid_model.new).to have_secure_token(:auth_token) + end + + it 'does not match when missing an token index' do + create_table(:users) do |t| + t.string :token + end - invalid_model = define_model_class(:User) { has_secure_token } - expected_message = - 'Expected User to have :token as a secure token but the following ' \ - 'errors were found: missing unique index for users.token' + invalid_model = define_model_class(:User) { has_secure_token } + expected_message = + 'Expected User to have :token as a secure token but the following ' \ + 'errors were found: missing unique index for users.token' - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token - expect { expect(invalid_model.new).to have_secure_token }. - to fail_with_message(expected_message) - end - end - - it 'matches when called with ignoring_check_for_db_index without db index' do - create_table(:users) do |t| - t.string :token - end - - valid_model = define_model_class(:User) { has_secure_token } - expect(valid_model.new). - to have_secure_token.ignoring_check_for_db_index - end - - it 'does not match when missing a token column' do - create_table(:users) - invalid_model = define_model_class(:User) { has_secure_token } - - expected_message = - 'Expected User to have :token as a secure token but the following ' \ - 'errors were found: missing expected class and instance methods, ' \ - 'missing correct column token:string, missing unique index for ' \ - 'users.token' + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token + expect { expect(invalid_model.new).to have_secure_token }. + to fail_with_message(expected_message) + end + end - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token - expect { expect(invalid_model.new).to have_secure_token }. - to fail_with_message(expected_message) - end + it 'matches when called with ignoring_check_for_db_index without db index' do + create_table(:users) do |t| + t.string :token end - it 'does not match when when lacking has_secure_token' do - create_table(:users) do |t| - t.string :token - t.index :token - end + valid_model = define_model_class(:User) { has_secure_token } + expect(valid_model.new). + to have_secure_token.ignoring_check_for_db_index + end - invalid_model = define_model_class(:User) + it 'does not match when missing a token column' do + create_table(:users) + invalid_model = define_model_class(:User) { has_secure_token } - expected_message = - 'Expected User to have :token as a secure token but the following ' \ - 'errors were found: missing expected class and instance methods, ' \ - 'missing unique index for users.token' + expected_message = + 'Expected User to have :token as a secure token but the following ' \ + 'errors were found: missing expected class and instance methods, ' \ + 'missing correct column token:string, missing unique index for ' \ + 'users.token' - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token - expect { expect(invalid_model.new).to have_secure_token }. - to fail_with_message(expected_message) - end + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token + expect { expect(invalid_model.new).to have_secure_token }. + to fail_with_message(expected_message) end + end - it 'does not match when missing an index for a custom attribute' do - create_table(:users) do |t| - t.string :auth_token - end + it 'does not match when when lacking has_secure_token' do + create_table(:users) do |t| + t.string :token + t.index :token + end - invalid_model = define_model_class(:User) do - has_secure_token(:auth_token) - end + invalid_model = define_model_class(:User) - expected_message = - 'Expected User to have :auth_token as a secure token but the ' \ - 'following errors were found: missing unique index for ' \ - 'users.auth_token' + expected_message = + 'Expected User to have :token as a secure token but the following ' \ + 'errors were found: missing expected class and instance methods, ' \ + 'missing unique index for users.token' - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token(:auth_token) - expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. - to fail_with_message(expected_message) - end + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token + expect { expect(invalid_model.new).to have_secure_token }. + to fail_with_message(expected_message) end + end - it 'does not match when missing a column for a custom attribute' do - create_table(:users) - invalid_model = define_model_class(:User) do - has_secure_token(:auth_token) - end - - expected_message = - 'Expected User to have :auth_token as a secure token but the ' \ - 'following errors were found: missing expected class and instance ' \ - 'methods, missing correct column auth_token:string, missing unique ' \ - 'index for users.auth_token' + it 'does not match when missing an index for a custom attribute' do + create_table(:users) do |t| + t.string :auth_token + end - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token(:auth_token) - expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. - to fail_with_message(expected_message) - end - end + invalid_model = define_model_class(:User) do + has_secure_token(:auth_token) + end - it 'does not match when when lacking has_secure_token for the attribute' do - create_table(:users) do |t| - t.string :auth_token - t.index :auth_token, unique: true - end + expected_message = + 'Expected User to have :auth_token as a secure token but the ' \ + 'following errors were found: missing unique index for ' \ + 'users.auth_token' - invalid_model = define_model_class(:User) - expected_message = - 'Expected User to have :auth_token as a secure token but the ' \ - 'following errors were found: missing expected class and instance ' \ - 'methods' + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token(:auth_token) + expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. + to fail_with_message(expected_message) + end + end + + it 'does not match when missing a column for a custom attribute' do + create_table(:users) + invalid_model = define_model_class(:User) do + has_secure_token(:auth_token) + end - aggregate_failures do - expect(invalid_model.new).not_to have_secure_token(:auth_token) - expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. - to fail_with_message(expected_message) - end + expected_message = + 'Expected User to have :auth_token as a secure token but the ' \ + 'following errors were found: missing expected class and instance ' \ + 'methods, missing correct column auth_token:string, missing unique ' \ + 'index for users.auth_token' + + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token(:auth_token) + expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. + to fail_with_message(expected_message) end - - it 'fails with the appropriate message when negated' do - create_table(:users) do |t| - t.string :token - t.index :token, unique: true - end - - valid_model = define_model_class(:User) { has_secure_token } - - expect { expect(valid_model.new).not_to have_secure_token }. - to fail_with_message('Did not expect User to have secure token :token') + end + + it 'does not match when when lacking has_secure_token for the attribute' do + create_table(:users) do |t| + t.string :auth_token + t.index :auth_token, unique: true end + + invalid_model = define_model_class(:User) + expected_message = + 'Expected User to have :auth_token as a secure token but the ' \ + 'following errors were found: missing expected class and instance ' \ + 'methods' + + aggregate_failures do + expect(invalid_model.new).not_to have_secure_token(:auth_token) + expect { expect(invalid_model.new).to have_secure_token(:auth_token) }. + to fail_with_message(expected_message) + end + end + + it 'fails with the appropriate message when negated' do + create_table(:users) do |t| + t.string :token + t.index :token, unique: true + end + + valid_model = define_model_class(:User) { has_secure_token } + + expect { expect(valid_model.new).not_to have_secure_token }. + to fail_with_message('Did not expect User to have secure token :token') end end diff --git a/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb b/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb index 7d4247ec3..96834370c 100644 --- a/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +++ b/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb @@ -852,11 +852,7 @@ end end - if ( - database_supports_array_columns? && - active_record_supports_array_columns? && - active_record_uniqueness_supports_array_columns? - ) + if database_supports_array_columns? context 'when one of the scoped attributes is a array-of-string column' do include_examples 'it supports scoped attributes of a certain type', column_type: :string, @@ -1153,29 +1149,27 @@ def configure_validation_matcher(matcher) end end - if active_record_supports_has_secure_password? - context 'when the model is declared with has_secure_password' do - context 'given a record whose attribute is nil' do - it 'accepts' do - model = define_model_validating_uniqueness( - validation_options: { allow_blank: true }, - additional_attributes: [{ name: :password_digest, type: :string }], &:has_secure_password - ) - record = build_record_from(model, attribute_name => nil) - expect(record).to validate_uniqueness.allow_blank - end + context 'when the model is declared with has_secure_password' do + context 'given a record whose attribute is nil' do + it 'accepts' do + model = define_model_validating_uniqueness( + validation_options: { allow_blank: true }, + additional_attributes: [{ name: :password_digest, type: :string }], &:has_secure_password + ) + record = build_record_from(model, attribute_name => nil) + expect(record).to validate_uniqueness.allow_blank end + end - context 'given a record whose attribute is empty' do - it 'accepts' do - model = define_model_validating_uniqueness( - attribute_type: :string, - validation_options: { allow_blank: true }, - additional_attributes: [{ name: :password_digest, type: :string }], &:has_secure_password - ) - record = build_record_from(model, attribute_name => '') - expect(record).to validate_uniqueness.allow_blank - end + context 'given a record whose attribute is empty' do + it 'accepts' do + model = define_model_validating_uniqueness( + attribute_type: :string, + validation_options: { allow_blank: true }, + additional_attributes: [{ name: :password_digest, type: :string }], &:has_secure_password + ) + record = build_record_from(model, attribute_name => '') + expect(record).to validate_uniqueness.allow_blank end end end