discourse/discourse — pull request #398 by ZogStriP (2013-03-08 16:38:35+00:00)
Title: [discussion] Disabling the observers by default in test

### /!\ WORK IN PROGRESS /!\

I found out that disabling the observers and manually enabling them when needed might help improving the speed of the test suite.

This is a [POC](http://en.wikipedia.org/wiki/Proof_of_concept) and is in no way finished.

With these modifications, I've managed to gain about **10 %** on the specifications for the user actions:

```bash
# running
$ time bundle exec rspec spec/models/user_action_spec.rb

# before
...
Finished in 9.25 seconds

real 0m33.464s
user 0m23.325s
sys 0m4.636s

# after
...
Finished in 6.34 seconds

real 0m30.495s
user 0m21.401s
sys 0m4.028s
```

Questions:
- Is it something worth doing?
- Should we start migrating off Observers instead? (as they have been [extracted our Rails 4](http://blog.remarkablelabs.com/2012/12/observers-gem-extraction-rails-4-countdown-to-2013))

**Note:** solution base on this article: [Test Observers with Rails 3.2.6](https://coderwall.com/p/asrvsw)