From 2b8487b0ea779b46f3c73713152bc4e81d355daa Mon Sep 17 00:00:00 2001 From: Nicolas Sebastian Vidal Date: Wed, 17 Apr 2019 18:41:37 -0300 Subject: [PATCH] Removed "shoulda" gem in favor of "shoulda-matchers" and update (#7387) * Update shoulda gem * Remove shoulda gem in favor of shoulda-matchers only --- Gemfile | 2 +- Gemfile.lock | 14 +++++--------- spec/models/category_spec.rb | 2 +- spec/rails_helper.rb | 12 +++++++++++- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 58c4866a136..84acce455af 100644 --- a/Gemfile +++ b/Gemfile @@ -135,7 +135,7 @@ group :test, :development do gem 'rb-fsevent', require: RUBY_PLATFORM =~ /darwin/i ? 'rb-fsevent' : false gem 'rb-inotify', '~> 0.9', require: RUBY_PLATFORM =~ /linux/i ? 'rb-inotify' : false gem 'rspec-rails', require: false - gem 'shoulda', require: false + gem 'shoulda-matchers', '~> 3.1', '>= 3.1.3', require: false gem 'rspec-html-matchers' gem 'pry-nav' gem 'byebug', require: ENV['RM_INFO'].nil? diff --git a/Gemfile.lock b/Gemfile.lock index 13faf684880..89a2aedf765 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,7 +86,7 @@ GEM open4 (~> 1.3) coderay (1.1.2) colored2 (3.1.2) - concurrent-ruby (1.1.4) + concurrent-ruby (1.1.5) connection_pool (2.2.2) cork (0.3.0) colored2 (~> 3.1) @@ -161,7 +161,7 @@ GEM hkdf (0.3.0) htmlentities (4.3.4) http_accept_language (2.0.5) - i18n (1.5.3) + i18n (1.6.0) concurrent-ruby (~> 1.0) image_size (1.5.0) in_threads (1.5.0) @@ -400,12 +400,8 @@ GEM seed-fu (2.3.9) activerecord (>= 3.1) activesupport (>= 3.1) - shoulda (3.5.0) - shoulda-context (~> 1.0, >= 1.0.1) - shoulda-matchers (>= 1.4.1, < 3.0) - shoulda-context (1.2.2) - shoulda-matchers (2.8.0) - activesupport (>= 3.0.0) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) sidekiq (5.2.5) connection_pool (~> 2.2, >= 2.2.2) rack (>= 1.5.0) @@ -557,7 +553,7 @@ DEPENDENCIES sassc sassc-rails seed-fu - shoulda + shoulda-matchers (~> 3.1, >= 3.1.3) sidekiq simplecov sprockets-rails diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb index 14670022b50..af47372859a 100644 --- a/spec/models/category_spec.rb +++ b/spec/models/category_spec.rb @@ -11,7 +11,7 @@ describe Category do it 'validates uniqueness of name' do Fabricate(:category) - is_expected.to validate_uniqueness_of(:name).scoped_to(:parent_category_id) + is_expected.to validate_uniqueness_of(:name).scoped_to(:parent_category_id).case_insensitive end it 'validates inclusion of search_priority' do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 63c2df73214..549735f8aaa 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -42,9 +42,19 @@ end ENV["RAILS_ENV"] ||= 'test' require File.expand_path("../../config/environment", __FILE__) require 'rspec/rails' -require 'shoulda' +require 'shoulda-matchers' require 'sidekiq/testing' +# The shoulda-matchers gem no longer detects the test framework +# you're using or mixes itself into that framework automatically. +Shoulda::Matchers.configure do |config| + config.integrate do |with| + with.test_framework :rspec + with.library :active_record + with.library :active_model + end +end + # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }