diff options
Diffstat (limited to 'railties/test/plugins/framework_extension_test.rb')
-rw-r--r-- | railties/test/plugins/framework_extension_test.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/railties/test/plugins/framework_extension_test.rb b/railties/test/plugins/framework_extension_test.rb new file mode 100644 index 0000000000..c920db77aa --- /dev/null +++ b/railties/test/plugins/framework_extension_test.rb @@ -0,0 +1,52 @@ +require "isolation/abstract_unit" + +module PluginsTest + class FrameworkExtensionTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + FileUtils.rm_rf("#{app_path}/config/environments") + require "rails/all" + end + + test "rake_tasks block is executed when MyApp.load_tasks is called" do + $ran_block = false + + class MyTie < Rails::Railtie + rake_tasks do + $ran_block = true + end + end + + require "#{app_path}/config/environment" + + assert !$ran_block + require 'rake' + require 'rake/testtask' + require 'rake/rdoctask' + + AppTemplate::Application.load_tasks + assert $ran_block + end + end + + class ActiveRecordExtensionTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + FileUtils.rm_rf("#{app_path}/config/environments") + end + + test "active_record extensions are applied to ActiveRecord" do + add_to_config "config.active_record.table_name_prefix = 'tbl_'" + + require "#{app_path}/config/environment" + + assert_equal 'tbl_', ActiveRecord::Base.table_name_prefix + end + end +end
\ No newline at end of file |