Deprecated gem options in application templates
Bunlder deprecated options
Update deprecated options in rails application template when
method "gem" is called and options are:
- :env
- :only
- :lib
- :require_as
For example:
Given I have a rails application template "my_template.rb"
with:
gem 'cucumber', :env => :test, :version =>
'>=0.7.2'
gem 'cucumber-rails', :only => :test
When I create a rails app with:
rails my_app --template=my_template.rb
Then "my_app/Gemfile" file should contain:
gem "cucumber", ">=0.7.2", :group =>
:test
gem "cucumber-rails", :group => :test
And I should get a warning message something like:
DEPRECATION WARNING: :env option in gem is
deprecated, use :group instead.
DEPRECATION WARNING: :only option in gem is
deprecated, use :group instead.
Updated Test file
(rails/railties/test/generators/actions_test.rb):
def test_gem_with_env_should_include_all_dependencies_in_gemfile
run_generator
assert_deprecated do
action :gem, 'rspec', :env => %w(development test)
end
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_options_should_include_all_options_in_gemfile
run_generator
assert_deprecated do
action :gem, 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com'
end
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
Versions
rails (3.0.0.beta3)
railties (3.0.0.beta3)
bundler (0.9.25)
Thank you.