diff options
author | Bundlerbot <bot@bundler.io> | 2019-03-15 08:34:05 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-03-15 08:34:05 +0000 |
commit | 449e7fa5c8d0fab7c026ce8b3cc9ca3eb01e7253 (patch) | |
tree | d3b2f11e2f36f4552fc4b7c5a98d5d47322e0b91 /spec/support/helpers.rb | |
parent | 236ccf776f1acaca660df7e1f53046b36afb2f9c (diff) | |
parent | 99d55c01577519b4bc6ca9565685eb8d3f8069f2 (diff) | |
download | bundler-449e7fa5c8d0fab7c026ce8b3cc9ca3eb01e7253.tar.gz |
Merge #7029
7029: Make deprecation specs less messy r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that deprecation specs, even though they are now passing, are very brittle. This is because most of them create multiple gem files (`gems.rb` and `Gemfile`), and thus display deprecation messages by default about that.
### What was your diagnosis of the problem?
My diagnosis was that each deprecation should test its own message, instead of having the same deprecation printed by most specs.
### What is your fix for the problem, implemented in this PR?
My fix is to make the specs create a single gem file, except for the ones that test the deprecation about multiple gem files.
### Why did you choose this fix out of the possible options?
I chose this fix because it makes the tests less brittle and do less unnecessary things.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'spec/support/helpers.rb')
-rw-r--r-- | spec/support/helpers.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index a5ff292f01..151c99c3ff 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -48,6 +48,16 @@ module Spec Bundler.feature_flag.error_on_stderr? ? last_command.stderr : last_command.stdout end + MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze + + def err_without_deprecations + last_command.stderr.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") + end + + def deprecations + err.split("\n").select {|l| l =~ MAJOR_DEPRECATION }.join("\n").split(MAJOR_DEPRECATION) + end + def exitstatus last_command.exitstatus end |