Skip to content
This repository
Browse code

Fixed that template runner gem method to output :lib => false correct…

…ly [#1940 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
commit 8a17fd1a65ab8e2fa6b36d79603fde0e6ffd083f 1 parent db26ace
authored March 12, 2009 lifo committed March 12, 2009
2  railties/lib/rails_generator/generators/applications/app/template_runner.rb
@@ -90,7 +90,7 @@ def gem(name, options = {})
90 90
       gems_code = "config.gem '#{name}'"
91 91
 
92 92
       if options.any?
93  
-        opts = options.inject([]) {|result, h| result << [":#{h[0]} => '#{h[1]}'"] }.sort.join(", ")
  93
+        opts = options.inject([]) {|result, h| result << [":#{h[0]} => #{h[1].inspect.gsub('"',"'")}"] }.sort.join(", ")
94 94
         gems_code << ", #{opts}"
95 95
       end
96 96
 
5  railties/test/generators/rails_template_runner_test.rb
@@ -93,6 +93,11 @@ def test_gem_with_env_array_should_put_gem_dependency_in_specified_environments
93 93
     assert_generated_file_with_data('config/environments/test.rb', "config.gem 'quietbacktrace'")
94 94
   end
95 95
 
  96
+  def test_gem_with_lib_option_set_to_false_should_put_gem_dependency_in_enviroment_correctly
  97
+    run_template_method(:gem, 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com')
  98
+    assert_rails_initializer_includes("config.gem 'mislav-will-paginate', :lib => false, :source => 'http://gems.github.com'")
  99
+  end
  100
+
96 101
   def test_environment_should_include_data_in_environment_initializer_block
97 102
     load_paths = 'config.load_paths += %w["#{RAILS_ROOT}/app/extras"]'
98 103
     run_template_method(:environment, load_paths)

0 notes on commit 8a17fd1

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