diff options
author | Andrew Vit <andrew@avit.ca> | 2009-02-15 19:33:12 -0800 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-02-28 17:59:01 +0000 |
commit | 16b3d2b621b1682f249209097c31b0a10f0f87ef (patch) | |
tree | 50dcce6566e3cd30d3a45fd05ad6d2e9951b51b3 /railties/test | |
parent | 8607740a29d0f9ceb2ca21c9ef714f74b64d4a88 (diff) | |
download | rails-16b3d2b621b1682f249209097c31b0a10f0f87ef.tar.gz rails-16b3d2b621b1682f249209097c31b0a10f0f87ef.tar.bz2 rails-16b3d2b621b1682f249209097c31b0a10f0f87ef.zip |
Added :env option for gem in template runner [#1983 state:resolved]
For installing gems that are only needed in the test environment, specify the :env option so the dependency is written to config/environments/test.rb:
gem 'rspec', :env => 'test'
gem 'quietbacktrace', :env => %w[development test]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators/rails_template_runner_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/railties/test/generators/rails_template_runner_test.rb b/railties/test/generators/rails_template_runner_test.rb index 56afc85eba..4e1937e0c6 100644 --- a/railties/test/generators/rails_template_runner_test.rb +++ b/railties/test/generators/rails_template_runner_test.rb @@ -82,6 +82,17 @@ class RailsTemplateRunnerTest < GeneratorTestCase assert_rails_initializer_includes("config.gem 'mislav-will-paginate', :lib => 'will-paginate', :source => 'http://gems.github.com'") end + def test_gem_with_env_string_should_put_gem_dependency_in_specified_environment + run_template_method(:gem, 'rspec', :env => 'test') + assert_generated_file_with_data('config/environments/test.rb', "config.gem 'rspec'", 'test') + end + + def test_gem_with_env_array_should_put_gem_dependency_in_specified_environments + run_template_method(:gem, 'quietbacktrace', :env => %w[ development test ]) + assert_generated_file_with_data('config/environments/development.rb', "config.gem 'quietbacktrace'") + assert_generated_file_with_data('config/environments/test.rb', "config.gem 'quietbacktrace'") + 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) |