1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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>
This commit is contained in:
Piotr Sarnacki 2010-09-25 13:11:07 +02:00 committed by José Valim
parent 0134c5cc94
commit f8294cb8ba
2 changed files with 9 additions and 0 deletions

View file

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

View file

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