From f252293a02dbd40aa43dd89828152209262f4d09 Mon Sep 17 00:00:00 2001 From: Duncan Stuart Date: Thu, 22 Aug 2019 15:36:05 +0200 Subject: [PATCH] Drop support for RSpec 2 I couldn't work out if it's officially unsupported, but RSpec3 came out around 5 years ago and we had a fair amount of code which seemed to only be there to support it. --- CHANGELOG.md | 1 + lib/pundit/rspec.rb | 20 +++++--------------- pundit.gemspec | 2 +- spec/spec_helper.rb | 16 ---------------- 4 files changed, 7 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e67a95a9..da15d28c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Removed - Dropped support for Ruby end-of-life versions: 2.1 and 2.2. +- Dropped support for RSpec 2 ## 2.1.0 (2019-08-14) diff --git a/lib/pundit/rspec.rb b/lib/pundit/rspec.rb index 687cf171..243ebec7 100644 --- a/lib/pundit/rspec.rb +++ b/lib/pundit/rspec.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/array/conversions" - module Pundit module RSpec module Matchers @@ -74,17 +72,9 @@ def self.included(base) end RSpec.configure do |config| - if RSpec::Core::Version::STRING.split(".").first.to_i >= 3 - config.include( - Pundit::RSpec::PolicyExampleGroup, - type: :policy, - file_path: %r{spec/policies} - ) - else - config.include( - Pundit::RSpec::PolicyExampleGroup, - type: :policy, - example_group: { file_path: %r{spec/policies} } - ) - end + config.include( + Pundit::RSpec::PolicyExampleGroup, + type: :policy, + file_path: %r{spec/policies} + ) end diff --git a/pundit.gemspec b/pundit.gemspec index 9c083168..677b9c4e 100644 --- a/pundit.gemspec +++ b/pundit.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency "bundler" gem.add_development_dependency "pry" gem.add_development_dependency "rake" - gem.add_development_dependency "rspec", ">= 2.0.0" + gem.add_development_dependency "rspec", ">= 3.0.0" gem.add_development_dependency "rubocop", "0.74.0" gem.add_development_dependency "yard" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fa671328..d18ee23a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,22 +11,6 @@ require "active_model/naming" require "action_controller/metal/strong_parameters" -I18n.enforce_available_locales = false - -module PunditSpecHelper - extend RSpec::Matchers::DSL - - matcher :be_truthy do - match do |actual| - actual - end - end -end - -RSpec.configure do |config| - config.include PunditSpecHelper -end - class PostPolicy < Struct.new(:user, :post) class Scope < Struct.new(:user, :scope) def resolve