Skip to content

Commit

Permalink
Fixed that template runner gem method to output :lib => false correct…
Browse files Browse the repository at this point in the history
…ly [#1940 state:resolved]

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information
Damian Terentiev authored and lifo committed Mar 12, 2009
1 parent db26ace commit 8a17fd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions railties/test/generators/rails_template_runner_test.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 8a17fd1

Please sign in to comment.