Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Testcase for #5847 and #4045.

  • Loading branch information...
commit 65fa5121b803847ab6708f1318f58d5c79c0da74 1 parent db6787a
Toshinori Kajihara authored

Showing 1 changed file with 23 additions and 0 deletions. Show diff stats Hide diff stats

  1. +23 0 railties/test/application/rake_test.rb
23 railties/test/application/rake_test.rb
@@ -150,5 +150,28 @@ def test_rake_dump_structure_should_be_called_twice_when_migrate_redo
150 150 # expect only Invoke db:structure:dump (first_time)
151 151 assert_no_match(/^\*\* Invoke db:structure:dump\s+$/, output)
152 152 end
  153 +
  154 + def test_load_activerecord_base_when_we_use_observers
  155 + Dir.chdir(app_path) do
  156 + `bundle exec rails g model user;
  157 + bundle exec rake db:migrate;
  158 + bundle exec rails g observer user;`
  159 +
  160 + add_to_config "config.active_record.observers = :user_observer"
  161 +
  162 + assert_equal "0", `bundle exec rails r "puts User.count"`.strip
  163 +
  164 + app_file "lib/tasks/count_user.rake", <<-RUBY
  165 + namespace :user do
  166 + task :count => :environment do
  167 + puts User.count
  168 + end
  169 + end
  170 + RUBY
  171 +
  172 + assert_equal "0", `bundle exec rake user:count`.strip
  173 + end
  174 + end
  175 +
153 176 end
154 177 end

0 comments on commit 65fa512

Please sign in to comment.
Something went wrong with that request. Please try again.