diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index 9be847d583a..e2994e4b264 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.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] diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb index 77444f2dade..b9dc7d05f7c 100644 --- a/spec/install/gems/simple_case_spec.rb +++ b/spec/install/gems/simple_case_spec.rb @@ -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}"