# Testing: switch on all caching?

**URL:** <https://www.ruby-forum.com/t/testing-switch-on-all-caching/160486>\
**Category:** Rails\
**Created:** [February 16, 2009, 10:59pm UTC](https://www.ruby-forum.com/t/testing-switch-on-all-caching/160486 "2009-02-16T22:59:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [February 16, 2009, 10:59pm UTC](https://www.ruby-forum.com/t/testing-switch-on-all-caching/160486/1 "2009-02-16T22:59:59Z")

</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:** ![itsastickup](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [February 17, 2009, 1:09am UTC](https://www.ruby-forum.com/t/testing-switch-on-all-caching/160486/2 "2009-02-17T01:09:39Z")

</div>

On Feb 16, 4:58 pm, itsastickup [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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?

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://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/7feea3/32.png) [@itsastickup](https://www.ruby-forum.com/u/itsastickup)\
**Post date:** [February 18, 2009, 2:48am UTC](https://www.ruby-forum.com/t/testing-switch-on-all-caching/160486/3 "2009-02-18T02:48:03Z")

</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.
