# Using unit\_record and rspec (previously "Keeping unit tests from hitting the DB")

**URL:** <https://www.ruby-forum.com/t/using-unit-record-and-rspec-previously-keeping-unit-tests-from-hitting-the-db/117822>\
**Category:** RSpec\
**Created:** [October 20, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/using-unit-record-and-rspec-previously-keeping-unit-tests-from-hitting-the-db/117822 "2007-10-20T21:52:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![timhunter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/71e660/32.png) [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Post date:** [October 20, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/using-unit-record-and-rspec-previously-keeping-unit-tests-from-hitting-the-db/117822/1 "2007-10-20T21:52:19Z")

</div>

Back in August David C. wrote:

“FYI - I tried using the unit\_record gem and there are some changes  
required in rspec to make it work, but they are trivial and it works  
great. The only trick is that the prevention of DB access is global  
per process, so you’d have to separate examples that hit the DB from  
those that don’t into two separate suites. I’ll explore this  
possibility and follow up.”

I’ve taken a quick look through the latest RDocs and the rspec-devel  
archives but cannot see (maybe through my own stupidity) anything  
that suggests that trunk now supports unit\_record out of the box, with  
or without a configuration setting.

I would very much like to experiment with unit\_record but would prefer  
to do so with rspec rather then with test::unit. Not knowing the rspec  
internals myself, please can we have an update on the status or see  
the trivial patch that allows us to try this for ourselves.

Many thanks in advance.

Tim

---

<div class="post-metadata">

**Author:** ![timhunter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/71e660/32.png) [@timhunter](https://www.ruby-forum.com/u/timhunter)\
**Post date:** [October 20, 2007, 10:07pm UTC](https://www.ruby-forum.com/t/using-unit-record-and-rspec-previously-keeping-unit-tests-from-hitting-the-db/117822/2 "2007-10-20T22:07:33Z")

</div>

On 10/20/07, Tim H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> archives but cannot see (maybe through my own stupidity) anything  
> that suggests that trunk now supports unit\_record out of the box, with  
> or without a configuration setting.
> 
> I would very much like to experiment with unit\_record but would prefer  
> to do so with rspec rather then with test::unit. Not knowing the rspec  
> internals myself, please can we have an update on the status or see  
> the trivial patch that allows us to try this for ourselves.

This fell off the radar. I just added feature request:  
[http://rubyforge.org/tracker/index.php?group\_id=797&atid=3152](http://rubyforge.org/tracker/index.php?group_id=797&atid=3152)

Not the highest priority right now for me, but patches are welcome.

Cheers,  
David
