Permalink
Browse files

Raise an appropriate error when a gem is specified using a symbol.

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 8, 2010
1 parent eda7324 commit 5e6b09469afd16719cdc9a0856c6f0da0489f55f
Showing with 12 additions and 0 deletions.
  1. +4 −0 lib/bundler/dsl.rb
  2. +8 −0 spec/install/gems/simple_case_spec.rb
@@ -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]
@@ -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}"

0 comments on commit 5e6b094

Please sign in to comment.