Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Remove LessThanProc #7030

Merged
4 commits merged into from
Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions spec/commands/exec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -537,11 +537,6 @@ def bin_path(a,b,c)
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
Expand All @@ -560,13 +555,8 @@ def bin_path(a,b,c)
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
Expand Down Expand Up @@ -694,21 +684,13 @@ def bin_path(a,b,c)
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

Expand Down
9 changes: 3 additions & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,10 @@ def self.ruby=(ruby)
config.filter_run_excluding :realworld => true
end

git_version = Bundler::Source::Git::GitProxy.new(nil, nil, nil).version

config.filter_run_excluding :ruby => LessThanProc.with(RUBY_VERSION)
config.filter_run_excluding :rubygems => LessThanProc.with(Gem::VERSION)
config.filter_run_excluding :git => LessThanProc.with(git_version)
config.filter_run_excluding :ruby => RequirementChecker.against(RUBY_VERSION)
config.filter_run_excluding :rubygems => RequirementChecker.against(Gem::VERSION)
config.filter_run_excluding :rubygems_master => (ENV["RGV"] != "master")
config.filter_run_excluding :bundler => LessThanProc.with(Bundler::VERSION.split(".")[0, 2].join("."))
config.filter_run_excluding :bundler => RequirementChecker.against(Bundler::VERSION.split(".")[0])
config.filter_run_excluding :ruby_repo => !(ENV["BUNDLE_RUBY"] && ENV["BUNDLE_GEM"]).nil?

config.filter_run_when_matching :focus unless ENV["CI"]
Expand Down
20 changes: 0 additions & 20 deletions spec/support/less_than_proc.rb

This file was deleted.

11 changes: 11 additions & 0 deletions spec/support/requirement_checker.rb
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