mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fixes unescaped version passthrough of generator 'gem' command. [#3901 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
cafe882d12
commit
9c654744fb
2 changed files with 19 additions and 1 deletions
|
@ -69,7 +69,7 @@ module Rails
|
||||||
# otherwise use name (version).
|
# otherwise use name (version).
|
||||||
parts, message = [ name.inspect ], name
|
parts, message = [ name.inspect ], name
|
||||||
if version ||= options.delete(:version)
|
if version ||= options.delete(:version)
|
||||||
parts << version
|
parts << version.inspect
|
||||||
message << " (#{version})"
|
message << " (#{version})"
|
||||||
end
|
end
|
||||||
message = options[:git] if options[:git]
|
message = options[:git] if options[:git]
|
||||||
|
|
|
@ -103,6 +103,24 @@ class ActionsTest < Rails::Generators::TestCase
|
||||||
assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/
|
assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/
|
||||||
end
|
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
|
def test_environment_should_include_data_in_environment_initializer_block
|
||||||
run_generator
|
run_generator
|
||||||
load_paths = 'config.load_paths += %w["#{Rails.root}/app/extras"]'
|
load_paths = 'config.load_paths += %w["#{Rails.root}/app/extras"]'
|
||||||
|
|
Loading…
Reference in a new issue