Skip to content

Commit

Permalink
Use Gem.bin_path to obtain bundle command name.
Browse files Browse the repository at this point in the history
  • Loading branch information
y-higuchi committed Mar 5, 2013
1 parent b839dc7 commit 4d3fc83
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
5 changes: 3 additions & 2 deletions lib/cucumber/rake/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def gem_available_new_rubygems?(gemname)

def cmd
if use_bundler
bundle_cmd = Gem.default_exec_format % 'bundle'
bundle_cmd = Gem.bin_path('bundler', 'bundle')
[ Cucumber::RUBY_BINARY, '-S', bundle_cmd, 'exec', 'cucumber', @cucumber_opts,
@feature_files ].flatten
else
Expand All @@ -115,7 +115,8 @@ def initialize(libs, cucumber_bin, cucumber_opts, bundler, feature_files, rcov_o

def cmd
if use_bundler
[Cucumber::RUBY_BINARY, '-S', 'bundle', 'exec', 'rcov', @rcov_opts,
bundle_cmd = Gem.bin_path('bundler', 'bundle')
[Cucumber::RUBY_BINARY, '-S', bundle_cmd, 'exec', 'rcov', @rcov_opts,
quoted_binary(@cucumber_bin), '--', @cucumber_opts, @feature_files].flatten
else
[Cucumber::RUBY_BINARY, '-I', load_path(@libs), '-S', 'rcov', @rcov_opts,
Expand Down
8 changes: 4 additions & 4 deletions spec/cucumber/rake/forked_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ module Rake
end

it "uses bundle exec to find cucumber and libraries" do
bundle_cmd = Gem.default_exec_format % 'bundle'
Gem.stub(:bin_path).with('bundler','bundle').and_return('/path/to/bundle')

subject.cmd.should == [Cucumber::RUBY_BINARY,
'-S',
bundle_cmd,
'/path/to/bundle',
'exec',
'cucumber',
'--cuke-option'] + feature_files
end

it "obeys program suffix for bundler" do
Gem::ConfigMap.stub(:[]).with(:ruby_install_name).and_return('XrubyY')
Gem.stub(:bin_path).with('bundler','bundle').and_return('/path/to/XbundleY')

subject.cmd.should == [Cucumber::RUBY_BINARY,
'-S',
'XbundleY',
'/path/to/XbundleY',
'exec',
'cucumber',
'--cuke-option'] + feature_files
Expand Down
17 changes: 16 additions & 1 deletion spec/cucumber/rake/rcov_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,24 @@ module Rake
end

it "uses bundle exec to find cucumber and libraries" do
Gem.stub(:bin_path).with('bundler','bundle').and_return('/path/to/bundle')
subject.cmd.should == [Cucumber::RUBY_BINARY,
'-S',
'bundle',
'/path/to/bundle',
'exec',
'rcov',
'--rcov-option',
"\"#{Cucumber::BINARY }\"",
'--',
'--cuke-option'] + feature_files
end

it "obeys program suffix for bundler" do
Gem.stub(:bin_path).with('bundler','bundle').and_return('/path/to/XbundleY')

subject.cmd.should == [Cucumber::RUBY_BINARY,
'-S',
'/path/to/XbundleY',
'exec',
'rcov',
'--rcov-option',
Expand Down

0 comments on commit 4d3fc83

Please sign in to comment.