Permalink
Browse files

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

…status:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent cafe882 commit 9c654744fbc5f3035e07f741997d37f287729103 Michael Bleigh committed with josevalim Feb 8, 2010
Showing with 19 additions and 1 deletion.
  1. +1 −1 railties/lib/rails/generators/actions.rb
  2. +18 −0 railties/test/generators/actions_test.rb
@@ -69,7 +69,7 @@ def gem(*args)
# otherwise use name (version).
parts, message = [ name.inspect ], name
if version ||= options.delete(:version)
- parts << version
+ parts << version.inspect
message << " (#{version})"
end
message = options[:git] if options[:git]
@@ -103,6 +103,24 @@ def test_gem_with_env_should_include_all_dependencies_in_gemfile
assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/
end
+ def test_gem_with_version_should_include_version_in_gemfile
+ run_generator
+
+ action :gem, 'rspec', '>=2.0.0.a5'
+
+ assert_file 'Gemfile', /gem "rspec", ">=2.0.0.a5"/
+ end
+
+ def test_gem_should_insert_on_separate_lines
+ run_generator
+
+ action :gem, 'rspec'
+ action :gem, 'rspec-rails'
+
+ assert_file 'Gemfile', /gem "rspec"$/
+ assert_file 'Gemfile', /gem "rspec-rails"$/
+ end
+
def test_environment_should_include_data_in_environment_initializer_block
run_generator
load_paths = 'config.load_paths += %w["#{Rails.root}/app/extras"]'

0 comments on commit 9c65474

Please sign in to comment.