This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
7030: Remove `LessThanProc` r=colby-swandale a=deivid-rodriguez ### What was the end-user problem that led to this PR? The problem was that the `LessThanProc` class we use for filtering specs is confusing, in my opinion. For example, if I tag a spec with `:bundler => "2"`, I would expect it to run only against bundler 2. However, that's not how it works, it instead runs against any bundler higher than or equal to 2. ### What was your diagnosis of the problem? My diagnosis was that the `LessThanProc` class could be much simpler, and just check that the passed requirement matches the version the class was created with. ### What is your fix for the problem, implemented in this PR? My fix is to simplify the `LessThanProc` class to only do requirement matching, and remove the "less than" functionality. ### Why did you choose this fix out of the possible options? I chose this fix because in my opinion it's simpler to understand and less surprising. Co-authored-by: David Rodríguez <[email protected]>
- Loading branch information
Showing
4 changed files
with
18 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class RequirementChecker < Proc | ||
def self.against(present) | ||
provided = Gem::Version.new(present) | ||
|
||
new do |required| | ||
!Gem::Requirement.new(required).satisfied_by?(provided) | ||
end | ||
end | ||
end |