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

Commit

Permalink
Raise an appropriate error when a gem is specified using a symbol.
Browse files Browse the repository at this point in the history
Previously, bundler would raise an error like "Could not find gem 'foo' in any of the gem sources", which was misleading and confusing.  This closes #434.
  • Loading branch information
myronmarston authored and wycats committed Jul 9, 2010
1 parent eda7324 commit 5e6b094
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/bundler/dsl.rb
Expand Up @@ -44,6 +44,10 @@ def gemspec(opts)
end

def gem(name, *args)
if name.is_a?(Symbol)
raise GemfileError, %{You need to specify gem names as Strings. Use 'gem "#{name.to_s}"' instead.}
end

options = Hash === args.last ? args.pop : {}
version = args.last || ">= 0"
if group = options[:groups] || options[:group]
Expand Down
8 changes: 8 additions & 0 deletions spec/install/gems/simple_case_spec.rb
Expand Up @@ -21,6 +21,14 @@
should_be_installed("rack 1.0.0")
end

it "raises an appropriate error when gems are specified using symbols" do
status = install_gemfile(<<-G, :exit_status => true)
source "file://#{gem_repo1}"
gem :rack
G
status.should == 4
end

it "pulls in dependencies" do
install_gemfile <<-G
source "file://#{gem_repo1}"
Expand Down

0 comments on commit 5e6b094

Please sign in to comment.