diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-19 18:43:09 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-19 19:59:08 +0100 |
commit | 4ca97650880a751901c4370a50c806a84fa529f4 (patch) | |
tree | fedf6fc1dfc022015bc4f9c53004035a58e7a544 /railties/test | |
parent | 9acf0af544f2f5dcaf257bdc25047017c972ffce (diff) | |
download | rails-4ca97650880a751901c4370a50c806a84fa529f4.tar.gz rails-4ca97650880a751901c4370a50c806a84fa529f4.tar.bz2 rails-4ca97650880a751901c4370a50c806a84fa529f4.zip |
Allow railties to specify generators paths.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/generators_test.rb | 7 | ||||
-rw-r--r-- | railties/test/plugins/framework_extension_test.rb | 16 |
2 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/generators_test.rb b/railties/test/generators_test.rb index 60c81a813f..664d1e5670 100644 --- a/railties/test/generators_test.rb +++ b/railties/test/generators_test.rb @@ -148,6 +148,13 @@ class GeneratorsTest < Rails::Generators::TestCase Rails::Generators.subclasses.delete(klass) end + def test_load_generators_from_railties + Rails::Generators::ModelGenerator.expects(:start).with(["Account"], {}) + Rails::Generators.send(:remove_instance_variable, :@generators_from_railties) + Rails.application.expects(:load_generators) + Rails::Generators.invoke("model", ["Account"]) + end + def test_rails_root_templates template = File.join(Rails.root, "lib", "templates", "active_record", "model", "model.rb") diff --git a/railties/test/plugins/framework_extension_test.rb b/railties/test/plugins/framework_extension_test.rb index c920db77aa..d57fd4e635 100644 --- a/railties/test/plugins/framework_extension_test.rb +++ b/railties/test/plugins/framework_extension_test.rb @@ -30,6 +30,22 @@ module PluginsTest AppTemplate::Application.load_tasks assert $ran_block end + + test "generators block is executed when MyApp.load_generators is called" do + $ran_block = false + + class MyTie < Rails::Railtie + generators do + $ran_block = true + end + end + + require "#{app_path}/config/environment" + + assert !$ran_block + AppTemplate::Application.load_generators + assert $ran_block + end end class ActiveRecordExtensionTest < Test::Unit::TestCase |