diff options
author | Bundlerbot <bot@bundler.io> | 2019-07-23 20:56:22 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-07-23 20:56:22 +0000 |
commit | 72f9bdb158decfc33f31e527c4cdd2503c70d91b (patch) | |
tree | 89a5e1f75a50933424dfc3ad94592917b0322717 | |
parent | e9c83b85622ebffecc645dcf092af8b607f46f10 (diff) | |
parent | 1ee77d9c5500200a1dde874a59432e0fab861358 (diff) | |
download | bundler-72f9bdb158decfc33f31e527c4cdd2503c70d91b.tar.gz |
Merge #7260
7260: Better info about spec exclusions r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that current tests are very cryptic about the tests that are being excluded:
```
$ bin/rspec
Run options: exclude {:non_windows=>false, :ruby_repo=>false, :bundler=>#<RequirementChecker:./spec/support/requirement_checker.rb:7>, :git=>#<RequirementChecker:./spec/support/requirement_checker.rb:7>, :rubygems=>#<RequirementChecker:./spec/support/requirement_checker.rb:7>, :ruby=>#<RequirementChecker:./spec/support/requirement_checker.rb:7>, :realworld=>true, :sudo=>true}
Randomized with seed 22209
...
```
### What was your diagnosis of the problem?
My diagnosis was that the `RequirementChecker` class needs a better text representation.
### What is your fix for the problem, implemented in this PR?
My fix is to add an `inspect` method that informs better about the exclusion. Now:
```
$ bin/rspec
Run options: exclude {:non_windows=>false, :ruby_repo=>false, :bundler=>"!= 2", :git=>"!= 2.22.0", :rubygems=>"!= 3.0.4", :ruby=>"!= 2.6.3", :realworld=>true, :sudo=>true}
Randomized with seed 36536
...
```
### Why did you choose this fix out of the possible options?
I chose this fix because it makes it easier to understand what's going on.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
-rw-r--r-- | spec/support/requirement_checker.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/support/requirement_checker.rb b/spec/support/requirement_checker.rb index d8f5fd5e5f..e6bd0eb50d 100644 --- a/spec/support/requirement_checker.rb +++ b/spec/support/requirement_checker.rb @@ -6,6 +6,14 @@ class RequirementChecker < Proc new do |required| !Gem::Requirement.new(required).satisfied_by?(provided) + end.tap do |checker| + checker.provided = provided end end + + attr_accessor :provided + + def inspect + "\"!= #{provided}\"" + end end |