Browse files

Testcase for #5847 and #4045.

  • Loading branch information...
1 parent db6787a commit 65fa5121b803847ab6708f1318f58d5c79c0da74 @kennyj committed Apr 17, 2012
Showing with 23 additions and 0 deletions.
  1. +23 −0 railties/test/application/rake_test.rb
View
23 railties/test/application/rake_test.rb
@@ -150,5 +150,28 @@ def test_rake_dump_structure_should_be_called_twice_when_migrate_redo
# expect only Invoke db:structure:dump (first_time)
assert_no_match(/^\*\* Invoke db:structure:dump\s+$/, output)
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

0 comments on commit 65fa512

Please sign in to comment.