-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for bundler path issue in Cucumber Rake task #386 #388
Changes from 2 commits
4d3fc83
ded9589
d08dc89
d5a677c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,18 +24,18 @@ 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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to stub this method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I stubbed this method to make these spec examples to cover 2 types of test cases.
If it directly calls the |
||
|
||
subject.cmd.should == [Cucumber::RUBY_BINARY, | ||
'-S', | ||
bundle_cmd, | ||
'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', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ 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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same question: why do we have to stub the method here? |
||
subject.cmd.should == [Cucumber::RUBY_BINARY, | ||
'-S', | ||
'bundle', | ||
|
@@ -37,6 +38,20 @@ module Rake | |
'--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', | ||
'XbundleY', | ||
'exec', | ||
'rcov', | ||
'--rcov-option', | ||
"\"#{Cucumber::BINARY }\"", | ||
'--', | ||
'--cuke-option'] + feature_files | ||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you, please, describe the purpose of the spec? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This spec is a derivative of spec added with the original issue #324, which introduced the use of |
||
end | ||
|
||
context "when running without bundler" do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please extract this code into separate method. To remove code duplication and make this code more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've extracted the duplicate as
ForkedCucumberRunner#bundle_cmd
method. d08dc89