Unit testing with NullDB, Shoulda and Factory_Girl

Does anyone have any advice on how to setup NullDB in a JRuby on Rails
environment? Or is there a better way to avoid hitting the DB during
unit testing? I’m using JRuby 1.5.1, Rails 2.3.8, Test::Unit, Shoulda,
and will be using Factory_Girl for functional and integration tests. I
do not want to use RSpec. I’m fairly new to unit testing, but I think I
see the practical (speed) and theoretical benefit of not hitting the DB
for unit tests. Also, being new to unit testing, I could use as much
step by step instruction as you can give!

Cheers,
Eric

As far as I know, NullDb should work the same on JRuby as it does on
MRI. GitHub - nulldb/nulldb: An ActiveRecord null database adapter for greater speed and isolation in unit tests. should explain things to help you
get going. Though it does have documented RSpec integration, it seems
like you don’t have to use it.

I’d look for blog posts on factory_girl and shoulda setup. I’m not
versed in either but again they should work well on JRuby. If you find
anything unusual let us know.

/Nick

On Tue, Aug 3, 2010 at 1:01 AM, Eric S. [email protected]
wrote:

Eric

Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Nick S. wrote:

As far as I know, NullDb should work the same on JRuby as it does on
MRI. GitHub - nulldb/nulldb: An ActiveRecord null database adapter for greater speed and isolation in unit tests. should explain things to help you
get going. Though it does have documented RSpec integration, it seems
like you don’t have to use it.

I’d look for blog posts on factory_girl and shoulda setup. I’m not
versed in either but again they should work well on JRuby. If you find
anything unusual let us know.

/Nick

On Tue, Aug 3, 2010 at 1:01 AM, Eric S. [email protected]
wrote:

Eric

Posted via http://www.ruby-forum.com/.


To unsubscribe from this list, please visit:

� �http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hey Nick!

Thanks for the reply! Last night I found out that Factory_Girl has this
built in as well: Factory.build() doesn’t write to the database, only to
memory, so i can use factories and this functionality for my unit
testing when I need to. Best of both worlds… :smiley: Super stoked! Also, I
can’t believe it was you who replied. I’ve been wanting to thank you for
fixing the jdbc adapters! One of the other guys in my office suggested
installing the older jdbcmysql and jdbcsqlite adapters for our JRuby
evnvironments, it turns out that was preventing my unit tests from
working, then I stumbled upon your article about the update and now, I’m
TATFT! :smiley: Thank you SO much!

Cheers,
Eric