# testing: switch on all caching?

**URL:** <https://discuss.rubyonrails.org/t/testing-switch-on-all-caching/39425>\
**Category:** rubyonrails-talk\
**Created:** [February 16, 2009, 9:58pm UTC](https://discuss.rubyonrails.org/t/testing-switch-on-all-caching/39425 "2009-02-16T21:58:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsastickup](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@itsastickup](https://discuss.rubyonrails.org/u/itsastickup)\
**Post date:** [February 16, 2009, 9:58pm UTC](https://discuss.rubyonrails.org/t/testing-switch-on-all-caching/39425/1 "2009-02-16T21:58:27Z")

</div>

I would like to speed up my tests and I've noticed that not all caching is switched on in test.rb, and can't think why not.

I've thought to do this:

config.cache\_classes = true config.action\_controller.perform\_caching = true config.action\_view.cache\_template\_loading = true

Good idea?

---

<div class="post-metadata">

**Author:** ![jeff\_emminger](https://avatars.discourse-cdn.com/v4/letter/j/aca169/32.png) [@jeff\_emminger](https://discuss.rubyonrails.org/u/jeff_emminger)\
**Post date:** [February 17, 2009, 12:08am UTC](https://discuss.rubyonrails.org/t/testing-switch-on-all-caching/39425/2 "2009-02-17T00:08:36Z")

</div>

Try it and find out. Think about what might go wrong: do you have tests expecting some behavior that caching might interfere with?

Also, I have some pretty big test suites, but they run in 1- 2 minutes at most. How long are yours taking? Is it perhaps inefficient code?

---

<div class="post-metadata">

**Author:** ![itsastickup](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@itsastickup](https://discuss.rubyonrails.org/u/itsastickup)\
**Post date:** [February 18, 2009, 1:46am UTC](https://discuss.rubyonrails.org/t/testing-switch-on-all-caching/39425/3 "2009-02-18T01:46:55Z")

</div>

Thanks for the reply. It is that I can't think what would break. At the same time the project was configured by default with caching off, and yet a production site needs to have been tested with cacheing on. Therefore I would suppose there was a pretty good reason for that caching to be off that the rails devs know of, and I don't.
