aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkennyj <kennyj@gmail.com>2012-05-29 00:10:04 +0900
committerkennyj <kennyj@gmail.com>2012-05-29 22:32:14 +0900
commit8d01c61129217d48eeb4ae7afe04a5e98aad9ba0 (patch)
tree0926c6df4f100e0e3ffbd3595c0da72b8b07253a
parentd46a36805b93478f39039f4cab006f0aabd4cfd0 (diff)
downloadrails-8d01c61129217d48eeb4ae7afe04a5e98aad9ba0.tar.gz
rails-8d01c61129217d48eeb4ae7afe04a5e98aad9ba0.tar.bz2
rails-8d01c61129217d48eeb4ae7afe04a5e98aad9ba0.zip
Add a testcase for #5847.
-rw-r--r--railties/test/application/rake_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/railties/test/application/rake_test.rb b/railties/test/application/rake_test.rb
index 27d521485c..8cf867da3c 100644
--- a/railties/test/application/rake_test.rb
+++ b/railties/test/application/rake_test.rb
@@ -167,5 +167,28 @@ module ApplicationTests
end
assert !File.exists?(File.join(app_path, 'db', 'schema_cache.dump'))
end
+
+ def test_load_activerecord_base_when_we_use_observers
+ Dir.chdir(app_path) do
+ `bundle exec rails g model user;
+ bundle exec rake db:migrate;
+ bundle exec rails g observer user;`
+
+ add_to_config "config.active_record.observers = :user_observer"
+
+ assert_equal "0", `bundle exec rails r "puts User.count"`.strip
+
+ app_file "lib/tasks/count_user.rake", <<-RUBY
+ namespace :user do
+ task :count => :environment do
+ puts User.count
+ end
+ end
+ RUBY
+
+ assert_equal "0", `bundle exec rake user:count`.strip
+ end
+ end
+
end
end