Skip to content
This repository
Browse code

Fixes unescaped version passthrough of generator 'gem' command. [#3901

…status:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 9c654744fbc5f3035e07f741997d37f287729103 1 parent cafe882
Michael Bleigh authored February 08, 2010 josevalim committed February 10, 2010
2  railties/lib/rails/generators/actions.rb
@@ -69,7 +69,7 @@ def gem(*args)
69 69
         # otherwise use name (version).
70 70
         parts, message = [ name.inspect ], name
71 71
         if version ||= options.delete(:version)
72  
-          parts   << version
  72
+          parts   << version.inspect
73 73
           message << " (#{version})"
74 74
         end
75 75
         message = options[:git] if options[:git]
18  railties/test/generators/actions_test.rb
@@ -103,6 +103,24 @@ def test_gem_with_env_should_include_all_dependencies_in_gemfile
103 103
     assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/
104 104
   end
105 105
 
  106
+  def test_gem_with_version_should_include_version_in_gemfile
  107
+    run_generator
  108
+
  109
+    action :gem, 'rspec', '>=2.0.0.a5'
  110
+
  111
+    assert_file 'Gemfile', /gem "rspec", ">=2.0.0.a5"/
  112
+  end
  113
+
  114
+  def test_gem_should_insert_on_separate_lines
  115
+    run_generator
  116
+
  117
+    action :gem, 'rspec'
  118
+    action :gem, 'rspec-rails'
  119
+
  120
+    assert_file 'Gemfile', /gem "rspec"$/
  121
+    assert_file 'Gemfile', /gem "rspec-rails"$/
  122
+  end
  123
+
106 124
   def test_environment_should_include_data_in_environment_initializer_block
107 125
     run_generator
108 126
     load_paths = 'config.load_paths += %w["#{Rails.root}/app/extras"]'

0 notes on commit 9c65474

Please sign in to comment.
Something went wrong with that request. Please try again.