From a17bc04d159ec9839cc8cfb02dc0cdd2802110f4 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sun, 29 Sep 2019 18:01:32 +0200 Subject: Update to ruby/spec@e69a14c --- spec/ruby/library/rubygems/gem/bin_path_spec.rb | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 spec/ruby/library/rubygems/gem/bin_path_spec.rb (limited to 'spec/ruby/library/rubygems') diff --git a/spec/ruby/library/rubygems/gem/bin_path_spec.rb b/spec/ruby/library/rubygems/gem/bin_path_spec.rb new file mode 100644 index 0000000000..cdf9507bfd --- /dev/null +++ b/spec/ruby/library/rubygems/gem/bin_path_spec.rb @@ -0,0 +1,30 @@ +require_relative '../../../spec_helper' +require 'rubygems' + +describe "Gem.bin_path" do + before :each do + @bundle_gemfile = ENV['BUNDLE_GEMFILE'] + ENV['BUNDLE_GEMFILE'] = tmp("no-gemfile") + end + + after :each do + ENV['BUNDLE_GEMFILE'] = @bundle_gemfile + end + + it "finds executables of default gems, which are the only files shipped for default gems" do + # For instance, Gem.bin_path("bundler", "bundle") is used by rails new + + if Gem.respond_to? :default_specifications_dir + default_specifications_dir = Gem.default_specifications_dir + else + default_specifications_dir = Gem::Specification.default_specifications_dir + end + + Gem::Specification.each_spec([default_specifications_dir]) do |spec| + spec.executables.each do |exe| + path = Gem.bin_path(spec.name, exe) + File.exist?(path).should == true + end + end + end +end -- cgit v1.2.3