Bundler deprecated options in Gemfile with application template using method "gem" [#4534 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Adrian Sanchez
2010-05-05 01:39:59 -05:00
committed by José Valim
parent 9869ee77cd
commit bcf5fea5e5
2 changed files with 14 additions and 3 deletions

View File

@@ -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"

View File

@@ -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