diff options
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails_generator/generators/applications/app/template_runner.rb | 2 | ||||
-rw-r--r-- | railties/test/generators/rails_template_runner_test.rb | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/railties/lib/rails_generator/generators/applications/app/template_runner.rb b/railties/lib/rails_generator/generators/applications/app/template_runner.rb index 73ab57d4f0..3b49b1fa92 100644 --- a/railties/lib/rails_generator/generators/applications/app/template_runner.rb +++ b/railties/lib/rails_generator/generators/applications/app/template_runner.rb @@ -90,7 +90,7 @@ module Rails gems_code = "config.gem '#{name}'" if options.any? - opts = options.inject([]) {|result, h| result << [":#{h[0]} => '#{h[1]}'"] }.sort.join(", ") + opts = options.inject([]) {|result, h| result << [":#{h[0]} => #{h[1].inspect.gsub('"',"'")}"] }.sort.join(", ") gems_code << ", #{opts}" end diff --git a/railties/test/generators/rails_template_runner_test.rb b/railties/test/generators/rails_template_runner_test.rb index 4e1937e0c6..2da6bd59b5 100644 --- a/railties/test/generators/rails_template_runner_test.rb +++ b/railties/test/generators/rails_template_runner_test.rb @@ -93,6 +93,11 @@ class RailsTemplateRunnerTest < GeneratorTestCase assert_generated_file_with_data('config/environments/test.rb', "config.gem 'quietbacktrace'") end + def test_gem_with_lib_option_set_to_false_should_put_gem_dependency_in_enviroment_correctly + run_template_method(:gem, 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com') + assert_rails_initializer_includes("config.gem 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com'") + end + def test_environment_should_include_data_in_environment_initializer_block load_paths = 'config.load_paths += %w["#{RAILS_ROOT}/app/extras"]' run_template_method(:environment, load_paths) |