Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
Damian Terentiev authored lifo committed
View
2  railties/lib/rails_generator/generators/applications/app/template_runner.rb
@@ -90,7 +90,7 @@ def gem(name, options = {})
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
View
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
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)
Please sign in to comment.
Something went wrong with that request. Please try again.