diff options
author | Bundlerbot <bot@bundler.io> | 2019-03-15 11:32:28 +0000 |
---|---|---|
committer | Bundlerbot <bot@bundler.io> | 2019-03-15 11:32:28 +0000 |
commit | fe48bf85a06527d5f098560587a76e84adfbee65 (patch) | |
tree | 335733687411fe97f029b5c1fa7340acc1aaf3a4 /spec/commands | |
parent | 449e7fa5c8d0fab7c026ce8b3cc9ca3eb01e7253 (diff) | |
parent | 30fa1db6b2e58013d2ce55da12c6e9552bf45ab8 (diff) | |
download | bundler-fe48bf85a06527d5f098560587a76e84adfbee65.tar.gz |
Merge #7030
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 <deivid.rodriguez@riseup.net>
Diffstat (limited to 'spec/commands')
-rw-r--r-- | spec/commands/exec_spec.rb | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb index fd76caf2c4..08049cefb8 100644 --- a/spec/commands/exec_spec.rb +++ b/spec/commands/exec_spec.rb @@ -537,11 +537,6 @@ RSpec.describe "bundle exec" do let(:executable) do ex = super() ex << "\n" - if LessThanProc.with(RUBY_VERSION).call("1.9") - # Ruby < 1.9 needs a flush for a exit by signal, later - # rubies do not - ex << "STDOUT.flush\n" - end ex << "raise SignalException, 'SIGTERM'\n" ex end @@ -560,13 +555,8 @@ RSpec.describe "bundle exec" do let(:exit_code) { 0 } let(:expected) { "#{path} is empty" } let(:expected_err) { "" } - if LessThanProc.with(RUBY_VERSION).call("1.9") - # Kernel#exec in ruby < 1.9 will raise Errno::ENOEXEC if the command content is empty, - # even if the command is set as an executable. - pending "Kernel#exec is different" - else - it_behaves_like "it runs" - end + + it_behaves_like "it runs" end context "the executable is empty", :bundler => "2" do @@ -694,21 +684,13 @@ __FILE__: #{path.to_s.inspect} context "when the path is relative" do let(:path) { super().relative_path_from(bundled_app) } - if LessThanProc.with(RUBY_VERSION).call("1.9") - pending "relative paths have ./ __FILE__" - else - it_behaves_like "it runs" - end + it_behaves_like "it runs" end context "when the path is relative with a leading ./" do let(:path) { Pathname.new("./#{super().relative_path_from(Pathname.pwd)}") } - if LessThanProc.with(RUBY_VERSION).call("< 1.9") - pending "relative paths with ./ have absolute __FILE__" - else - it_behaves_like "it runs" - end + pending "relative paths with ./ have absolute __FILE__" end end |