-
-
Notifications
You must be signed in to change notification settings - Fork 2k
print an error message when a non-git gem is given a branch
option
#5559
print an error message when a non-git gem is given a branch
option
#5559
Conversation
lib/bundler/dsl.rb
Outdated
@@ -321,6 +321,10 @@ def normalize_options(name, version, opts) | |||
|
|||
normalize_hash(opts) | |||
|
|||
if opts["branch"] && !(opts["git"] || opts["github"]) |
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.
Why not do this in validate_keys
?
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 was being lazy and really should have checked. Thanks for the feedback!
spec/bundler/dsl_spec.rb
Outdated
|
||
it "rejects branch option on non-git gems" do | ||
expect { subject.gem("foo", :branch => "test") }. | ||
to raise_error(Bundler::GemfileError, /The `branch` option for `gem "foo"` is not allowed. Only gems with a git source can specify a branch/) |
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.
quotes don't match, hence the test failure
@@ -144,6 +144,11 @@ | |||
expect { subject.gem(:foo) }. | |||
to raise_error(Bundler::GemfileError, /You need to specify gem names as Strings. Use 'gem "foo"' instead/) | |||
end | |||
|
|||
it "rejects branch option on non-git gems" 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.
please also test that specifying a branch when using a user-defined git source still passes? (or make sure such a test exists?)
Only thing left is a test with a custom git source, otherwise this is 🚀 |
484eb47
to
261afb9
Compare
@bundlerbot r+ |
📌 Commit 261afb9 has been approved by |
print an error message when a non-git gem is given a `branch` option When the user supplies the `branch` option to a non-git gem an error message should be printed. Relates to #5530.
☀️ Test successful - status-travis |
When the user supplies the
branch
option to a non-git gem an error message should be printed.Relates to #5530.