aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-10-26 22:22:15 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-11-02 17:14:51 +0100
commit671d1469c6f70abb7cbd373bb37f18268ed7069c (patch)
tree10a8f231b09510f33931313b1e408344e586bbf2 /railties/test
parentfdbd9df21e0063da4b34346c54fbe21ac9583ca6 (diff)
downloadrails-671d1469c6f70abb7cbd373bb37f18268ed7069c.tar.gz
rails-671d1469c6f70abb7cbd373bb37f18268ed7069c.tar.bz2
rails-671d1469c6f70abb7cbd373bb37f18268ed7069c.zip
Add --full option to 'plugin new' generator, which generates rails engine
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/generators/plugin_new_generator_test.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb
index bf395749e5..f833411e3a 100644
--- a/railties/test/generators/plugin_new_generator_test.rb
+++ b/railties/test/generators/plugin_new_generator_test.rb
@@ -41,15 +41,28 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
def test_generating_test_files
run_generator
assert_file "test/test_helper.rb"
-
assert_file "test/bukkits_test.rb", /assert_kind_of Module, Bukkits/
end
+ def test_generating_test_files_in_full_mode
+ run_generator [destination_root, "--full"]
+ assert_directory "test/support/"
+ assert_directory "test/integration/"
+
+ assert_file "test/integration/navigation_test.rb", /assert_kind_of Dummy::Application, Rails.application/
+ assert_file "test/support/integration_case.rb", /class ActiveSupport::IntegrationCase/
+ end
+
def test_ensure_that_plugin_options_are_not_passed_to_app_generator
FileUtils.cd(Rails.root)
assert_no_match /It works from file!.*It works_from_file/, run_generator([destination_root, "-m", "lib/template.rb"])
end
+ def test_ensure_that_skip_active_record_option_is_passed_to_app_generator
+ run_generator [destination_root, "--skip_active_record"]
+ assert_no_file "test/dummy/config/database.yml"
+ end
+
def test_template_from_dir_pwd
FileUtils.cd(Rails.root)
assert_match /It works from file!/, run_generator([destination_root, "-m", "lib/template.rb"])
@@ -62,6 +75,19 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase
assert_match /1 tests, 1 assertions, 0 failures, 0 errors/, `bundle exec rake test`
end
+ def test_ensure_that_tests_works_in_full_mode
+ run_generator [destination_root, "--full"]
+ FileUtils.cd destination_root
+ `bundle install`
+ assert_match /2 tests, 2 assertions, 0 failures, 0 errors/, `bundle exec rake test`
+ end
+
+ def test_creating_engine_in_full_mode
+ run_generator [destination_root, "--full"]
+ assert_file "lib/bukkits/engine.rb", /module Bukkits\n class Engine < Rails::Engine\n end\nend/
+ assert_file "lib/bukkits.rb", /require "bukkits\/engine"/
+ end
+
protected
def action(*args, &block)