diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-01 12:11:36 -0300 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-05 15:11:19 -0300 |
commit | d88627a8191644fb970cce2140f3c320f3101c32 (patch) | |
tree | cb4455357dafd59963eb2dc624353ae907ebe932 /spec/support/matchers.rb | |
parent | 56c3b82d5ee5f6577ded051a9778b9aeeae14ab7 (diff) | |
download | bundler-d88627a8191644fb970cce2140f3c320f3101c32.tar.gz |
Clean up outdated deprecation code
Diffstat (limited to 'spec/support/matchers.rb')
-rw-r--r-- | spec/support/matchers.rb | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 186caa03ab..ac91874cfa 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -1,15 +1,28 @@ # frozen_string_literal: true module Spec module Matchers + MAJOR_DEPRECATION = /^\[DEPRECATED FOR 2\.0\]\s*/ + RSpec::Matchers.define :lack_errors do + diffable match do |actual| - actual.gsub(/(^DEPRECATION:.+[\n]?)/, "") == "" + actual.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") == "" end end RSpec::Matchers.define :eq_err do |expected| + diffable + match do |actual| + actual.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") == expected + end + end + + RSpec::Matchers.define :have_major_deprecation do |expected| + diffable match do |actual| - actual.gsub(/(^DEPRECATION:.+\n)/, "") == expected + actual.split(MAJOR_DEPRECATION).any? do |d| + !d.empty? && values_match?(expected, d.strip) + end end end |