# How do I speed up RSPEC?

**URL:** <https://www.ruby-forum.com/t/how-do-i-speed-up-rspec/122244>\
**Category:** Rails\
**Created:** [December 5, 2007, 9:20pm UTC](https://www.ruby-forum.com/t/how-do-i-speed-up-rspec/122244 "2007-12-05T21:20:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![akv292](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@akv292](https://www.ruby-forum.com/u/akv292)\
**Post date:** [December 5, 2007, 9:20pm UTC](https://www.ruby-forum.com/t/how-do-i-speed-up-rspec/122244/1 "2007-12-05T21:20:46Z")

</div>

I am setup on Mac (OS X) using RSPEC (version 1.0.8) for my tests.  
This is the first  
time I have used RSPEC before but it is running my tests extremely  
slowly. I was trying to use ‘Autotest’ with Growl, but even just  
the specs in my Terminal window is taking about a minute. Is a minute  
normal for 40 tests? They are just the generic tests created from  
rspec\_scaffold.

Here is the code printed when I run my test:  
/usr/local/bin/ruby -S script/spec -O spec/spec.opts spec/models/  
weather\_spec.rb spec/views/weathers/show.rhtml\_spec.rb spec/  
controllers/weathers\_controller\_spec.rb spec/views/weathers/  
new.rhtml\_spec.rb spec/views/weathers/edit.rhtml\_spec.rb spec/helpers/  
weathers\_helper\_spec.rb spec/views/weathers/index.rhtml\_spec.rb  
…

Finished in 49.875295 seconds

45 examples, 0 failures

What can I do to speed this up? Is this normal? I was thinking that  
0.9 seconds was normal.

Any suggestions would be appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![akv292](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@akv292](https://www.ruby-forum.com/u/akv292)\
**Post date:** [December 5, 2007, 11:56pm UTC](https://www.ruby-forum.com/t/how-do-i-speed-up-rspec/122244/2 "2007-12-05T23:56:44Z")

</div>

Spec::Runner.configure do |config|  
config.use\_transactional\_fixtures = true  
end

in spec\_helper.rb in spec/

Should be about 2 and a half times faster.

Are you aware how testing works?

Every time an individual test is run, whatever tables are specified in  
the  
fixtures are cleared and then filled up again with the fixtures.

Also, what kind of computer (specifications) are you running this under?

On Dec 6, 2007 6:50 AM, akv292 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> /usr/local/bin/ruby -S script/spec -O spec/spec.opts spec/models/
> 
> What can I do to speed this up? Is this normal? I was thinking that  
> 0.9 seconds was normal.
> 
> Any suggestions would be appreciated. Thanks.
> 
> >

–  
Ryan B.

---

<div class="post-metadata">

**Author:** ![akv292](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7ba0ec/32.png) [@akv292](https://www.ruby-forum.com/u/akv292)\
**Post date:** [December 7, 2007, 8:32pm UTC](https://www.ruby-forum.com/t/how-do-i-speed-up-rspec/122244/3 "2007-12-07T20:32:10Z")

</div>

I am working on Mac OS X Version 10.4.11; 2 Gigs RAM; 1.67 GHz PPC. I  
actually don’t know that much about tests. I am trying to get  
comfortable with Test-Driven Development, but I feel like the learning  
curve is very large.

I have noticed an improvement in speed with some more resources freed  
up on my computer. I am actually not using any fixtures at this point  
yet. I just ran an RSPEC scaffold and generated the specs that way.

I have another question about TextMate’s tests with the RSPEC bundle,  
but will probably open a new thread for it.

Thanks for your response Ryan.
