From 52d24e66cec1fa6c0100adb64effd2073869cd8b Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Sat, 18 May 2019 21:58:21 -0700 Subject: [PATCH] Bump shoulda-matchers to 4.0.1 This removes the warning when using Ruby 2.6: BigDecimal.new is deprecated; use BigDecimal() method instead. This also adds Rails 5 support, which eliminates the need for the monkey patch to handle https://github.com/thoughtbot/shoulda-matchers/issues/913. --- Gemfile | 2 +- Gemfile.lock | 6 ++--- spec/support/shoulda/matchers/rails_shim.rb | 27 --------------------- 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 spec/support/shoulda/matchers/rails_shim.rb diff --git a/Gemfile b/Gemfile index b6804a94971..e2842ca27db 100644 --- a/Gemfile +++ b/Gemfile @@ -379,7 +379,7 @@ group :development, :test do end group :test do - gem 'shoulda-matchers', '~> 3.1.2', require: false + gem 'shoulda-matchers', '~> 4.0.1', require: false gem 'email_spec', '~> 2.2.0' gem 'json-schema', '~> 2.8.0' gem 'webmock', '~> 3.5.1' diff --git a/Gemfile.lock b/Gemfile.lock index 2dbff1674df..a63b7cc84aa 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -857,8 +857,8 @@ GEM sexp_processor (4.12.0) sham_rack (1.3.6) rack - shoulda-matchers (3.1.2) - activesupport (>= 4.0.0) + shoulda-matchers (4.0.1) + activesupport (>= 4.2.0) sidekiq (5.2.7) connection_pool (~> 2.2, >= 2.2.2) rack (>= 1.5.0) @@ -1199,7 +1199,7 @@ DEPENDENCIES sentry-raven (~> 2.7) settingslogic (~> 2.0.9) sham_rack (~> 1.3.6) - shoulda-matchers (~> 3.1.2) + shoulda-matchers (~> 4.0.1) sidekiq (~> 5.2.7) sidekiq-cron (~> 1.0) simple_po_parser (~> 1.1.2) diff --git a/spec/support/shoulda/matchers/rails_shim.rb b/spec/support/shoulda/matchers/rails_shim.rb deleted file mode 100644 index 8d70598beb5..00000000000 --- a/spec/support/shoulda/matchers/rails_shim.rb +++ /dev/null @@ -1,27 +0,0 @@ -# monkey patch which fixes serialization matcher in Rails 5 -# https://github.com/thoughtbot/shoulda-matchers/issues/913 -# This can be removed when a new version of shoulda-matchers -# is released -module Shoulda - module Matchers - class RailsShim - def self.serialized_attributes_for(model) - if defined?(::ActiveRecord::Type::Serialized) - # Rails 5+ - serialized_columns = model.columns.select do |column| - model.type_for_attribute(column.name).is_a?( - ::ActiveRecord::Type::Serialized - ) - end - - serialized_columns.inject({}) do |hash, column| # rubocop:disable Style/EachWithObject - hash[column.name.to_s] = model.type_for_attribute(column.name).coder - hash - end - else - model.serialized_attributes - end - end - end - end -end