From 2020701924f4f01ad1ec133265ddfcd00c6f22f8 Mon Sep 17 00:00:00 2001 From: Adrian Sanchez Date: Wed, 5 May 2010 01:39:59 -0500 Subject: [PATCH] Bundler deprecated options in Gemfile with application template using method "gem" [#4534 state:resolved] --- railties/lib/rails/generators/actions.rb | 3 ++- railties/test/generators/actions_test.rb | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index a319329..7af329b 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -54,7 +54,8 @@ module Rails name, version = args # Deal with deprecated options - { :env => :only, :lib => :require_as }.each do |old, new| + { :env => :group, :only => :group, + :lib => :require, :require_as => :require }.each do |old, new| next unless options[old] options[new] = options.delete(old) ActiveSupport::Deprecation.warn "#{old.inspect} option in gem is deprecated, use #{new.inspect} instead" diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index e6fab93..65fbf61 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -86,8 +86,13 @@ class ActionsTest < Rails::Generators::TestCase action :gem, 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com' end - assert_file 'Gemfile', /gem "mislav\-will\-paginate", :require_as => "will\-paginate"/ + assert_deprecated do + action :gem, 'thoughtbot-factory_girl', :require_as => 'factory_girl', :source => 'http://gems.github.com' + end + + assert_file 'Gemfile', /gem "mislav\-will\-paginate", :require => "will\-paginate"/ assert_file 'Gemfile', /source "http:\/\/gems\.github\.com"/ + assert_file 'Gemfile', /gem "thoughtbot-factory_girl", :require => "factory_girl"/ end def test_gem_with_env_should_include_all_dependencies_in_gemfile @@ -97,7 +102,12 @@ class ActionsTest < Rails::Generators::TestCase action :gem, 'rspec', :env => %w(development test) end - assert_file 'Gemfile', /gem "rspec", :only => \["development", "test"\]/ + assert_deprecated do + action :gem, 'rspec-rails', :only => %w(development test) + end + + assert_file 'Gemfile', /gem "rspec", :group => \["development", "test"\]/ + assert_file 'Gemfile', /gem "rspec-rails", :group => \["development", "test"\]/ end def test_gem_with_version_should_include_version_in_gemfile -- 1.6.3.3