From f8294cb8bac6357727e7d5df5623349105c6f996 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Sat, 25 Sep 2010 13:11:07 +0200 Subject: [PATCH] Fix app and actions generators tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Normally Rails.application is an instance, but for those tests Rails.application needs to be class. Signed-off-by: José Valim --- railties/test/generators/actions_test.rb | 5 +++++ railties/test/generators/app_generator_test.rb | 4 ++++ 2 files changed, 9 insertions(+) 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