Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

print an error message when a non-git gem is given a branch option #5559

Merged
merged 5 commits into from
Apr 8, 2017

Conversation

colby-swandale
Copy link
Member

When the user supplies the branch option to a non-git gem an error message should be printed.

Relates to #5530.

@@ -321,6 +321,10 @@ def normalize_options(name, version, opts)

normalize_hash(opts)

if opts["branch"] && !(opts["git"] || opts["github"])
Copy link
Member

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?

Copy link
Member Author

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!


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/)
Copy link
Member

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
Copy link
Member

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?)

@segiddins
Copy link
Member

Only thing left is a test with a custom git source, otherwise this is 🚀

@segiddins
Copy link
Member

@bundlerbot r+

@bundlerbot
Copy link
Collaborator

📌 Commit 261afb9 has been approved by segiddins

@bundlerbot
Copy link
Collaborator

⌛ Testing commit 261afb9 with merge cdae668...

bundlerbot added a commit that referenced this pull request Apr 8, 2017
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.
@bundlerbot
Copy link
Collaborator

☀️ Test successful - status-travis
Approved by: segiddins
Pushing cdae668 to master...

@bundlerbot bundlerbot merged commit 261afb9 into rubygems:master Apr 8, 2017
@colby-swandale colby-swandale deleted the gem-branch-exception branch April 8, 2017 22:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants