diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-27 21:20:32 +0100 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2010-01-28 10:28:41 -0800 |
commit | e7418ab63cc4aa024367851f2f692032840cfe76 (patch) | |
tree | e6e104d8622b7237272e1b9ac75a70223f3c867f /railties/test/application/initializers | |
parent | 64ea3dfd9f14b09b65905a10379050ba2f42d8b8 (diff) | |
download | rails-e7418ab63cc4aa024367851f2f692032840cfe76.tar.gz rails-e7418ab63cc4aa024367851f2f692032840cfe76.tar.bz2 rails-e7418ab63cc4aa024367851f2f692032840cfe76.zip |
Add more tests to some key points in Railties.
Signed-off-by: Carl Lerche <carllerche@mac.com>
Diffstat (limited to 'railties/test/application/initializers')
-rw-r--r-- | railties/test/application/initializers/frameworks_test.rb | 6 | ||||
-rw-r--r-- | railties/test/application/initializers/load_path_test.rb | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/railties/test/application/initializers/frameworks_test.rb b/railties/test/application/initializers/frameworks_test.rb index ea052320ef..1e7b9c9997 100644 --- a/railties/test/application/initializers/frameworks_test.rb +++ b/railties/test/application/initializers/frameworks_test.rb @@ -71,6 +71,12 @@ module ApplicationTests assert_equal expects, middleware & expects 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 + test "database middleware doesn't initialize when activerecord is not in frameworks" do use_frameworks [] require "#{app_path}/config/environment" diff --git a/railties/test/application/initializers/load_path_test.rb b/railties/test/application/initializers/load_path_test.rb index 714b6114a2..b39b9ecaae 100644 --- a/railties/test/application/initializers/load_path_test.rb +++ b/railties/test/application/initializers/load_path_test.rb @@ -10,7 +10,6 @@ module ApplicationTests FileUtils.rm_rf "#{app_path}/config/environments" end - # General test "initializing an application adds the application paths to the load path" do add_to_config <<-RUBY config.root = "#{app_path}" @@ -20,10 +19,24 @@ module ApplicationTests assert $:.include?("#{app_path}/app/models") end + test "initializing an application eager load any path under app" do + app_file "app/anything/foo.rb", <<-RUBY + module Foo; end + RUBY + + add_to_config <<-RUBY + config.root = "#{app_path}" + RUBY + + require "#{app_path}/config/environment" + assert Foo + end + test "eager loading loads parent classes before children" do app_file "lib/zoo.rb", <<-ZOO class Zoo ; include ReptileHouse ; end ZOO + app_file "lib/zoo/reptile_house.rb", <<-ZOO module Zoo::ReptileHouse ; end ZOO @@ -34,7 +47,6 @@ module ApplicationTests RUBY require "#{app_path}/config/environment" - assert Zoo end |