diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-09-25 13:11:07 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-09-25 17:28:39 +0200 |
commit | f8294cb8bac6357727e7d5df5623349105c6f996 (patch) | |
tree | 4458bbec6232592cb24884094e9e4cb1620bac11 /railties | |
parent | 0134c5cc9429abe2427815606088d0084025ba67 (diff) | |
download | rails-f8294cb8bac6357727e7d5df5623349105c6f996.tar.gz rails-f8294cb8bac6357727e7d5df5623349105c6f996.tar.bz2 rails-f8294cb8bac6357727e7d5df5623349105c6f996.zip |
Fix app and actions generators tests
Normally Rails.application is an instance, but for those
tests Rails.application needs to be class.
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/generators/actions_test.rb | 5 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 7efd535419..4b29afdc8f 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -7,11 +7,16 @@ class ActionsTest < Rails::Generators::TestCase arguments [destination_root] def setup + Rails.application = TestApp::Application super @git_plugin_uri = 'git://github.com/technoweenie/restful-authentication.git' @svn_plugin_uri = 'svn://svnhub.com/technoweenie/restful-authentication/trunk' end + def teardown + Rails.application = TestApp::Application.instance + end + def test_invoke_other_generator_with_shortcut action :invoke, 'model', ['my_model'] assert_file 'app/models/my_model.rb', /MyModel/ diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 83a6f8bc20..3653b067c8 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -42,6 +42,7 @@ class AppGeneratorTest < Rails::Generators::TestCase arguments [destination_root] def setup + Rails.application = TestApp::Application super Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') @@ -56,6 +57,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def teardown super Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) + Rails.application = TestApp::Application.instance end def test_application_skeleton_is_created @@ -268,6 +270,7 @@ class CustomAppGeneratorTest < Rails::Generators::TestCase arguments [destination_root] def setup + Rails.application = TestApp::Application super Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') @@ -277,6 +280,7 @@ class CustomAppGeneratorTest < Rails::Generators::TestCase super Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) Object.class_eval { remove_const :AppBuilder if const_defined?(:AppBuilder) } + Rails.application = TestApp::Application.instance end def test_builder_option_with_empty_app_builder |