diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 18:01:32 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-09-29 18:01:32 +0200 |
commit | a17bc04d159ec9839cc8cfb02dc0cdd2802110f4 (patch) | |
tree | a10d4121aeb1517c198ab5b1577bca93912dc1f9 /spec/ruby/library/rubygems | |
parent | f9a9f3c7c6cf3fe534d4934dd3b502d721151b81 (diff) |
Update to ruby/spec@e69a14c
Diffstat (limited to 'spec/ruby/library/rubygems')
-rw-r--r-- | spec/ruby/library/rubygems/gem/bin_path_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
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 |