From 2133495b8cdcb40a68a03aa786c4353031abe49e Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Tue, 2 Nov 2010 14:23:45 +0100 Subject: Properly handle other databases in 'plugin new' generator --- railties/test/generators/plugin_new_generator_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'railties/test/generators/plugin_new_generator_test.rb') diff --git a/railties/test/generators/plugin_new_generator_test.rb b/railties/test/generators/plugin_new_generator_test.rb index 20c0d0a9bf..6b7095ba78 100644 --- a/railties/test/generators/plugin_new_generator_test.rb +++ b/railties/test/generators/plugin_new_generator_test.rb @@ -56,6 +56,23 @@ class PluginNewGeneratorTest < Rails::Generators::TestCase assert_no_match /It works from file!.*It works_from_file/, run_generator([destination_root, "-m", "lib/template.rb"]) end + def test_database_entry_is_assed_by_default_in_full_mode + run_generator([destination_root, "--full"]) + assert_file "test/dummy/config/database.yml", /sqlite/ + assert_file "Gemfile", /^gem\s+["']sqlite3-ruby["'],\s+:require\s+=>\s+["']sqlite3["']$/ + end + + def test_config_another_database + run_generator([destination_root, "-d", "mysql", "--full"]) + assert_file "test/dummy/config/database.yml", /mysql/ + assert_file "Gemfile", /^gem\s+["']mysql2["']$/ + end + + def test_active_record_is_removed_from_frameworks_if_skip_active_record_is_given + run_generator [destination_root, "--skip-active-record"] + assert_file "test/dummy/config/application.rb", /#\s+require\s+["']active_record\/railtie["']/ + 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" -- cgit v1.2.3