While testing against a test database is necessary for some scenarios, it
requires you to initialize AR per test, which slows down testing. Stubbing
AR-methods speeds up testing a lot.
-Markus

2009/10/20 Brian DeMarzo <[email protected]>

>
> If you don't want to touch a repository, why call Save() or Create()?
> If it's to test business logic related to saving or creating (such as
> validation), can you just test that separately?
>
> I've found saving against an actual test SQL database, prepopulated
> with data I can use for testing, quite useful, and have a blog post
> about how I did it:
>
> http://www.sidesofmarch.com/index.php/archive/2009/01/14/unit-testing-an-activerecord-domain-model-with-nunit/
>
>
>  - b
>
>
>
> On Oct 19, 10:07 am, Srdjan Pejic <[email protected]> wrote:
> > You could also create a test database and run your tests on that.
> > SetUp and TearDown methods will make sure you don't leave data in the
> > database.
> >
> > Srdjan
> >
> > On Oct 17, 8:23 pm, Mike Christensen <[email protected]> wrote:
> >
> > > When writing unit tests for code that uses ActiveRecord, I want to be
> > > able to call stuff like "Save()" and "Create()" without actually
> > > touching the DB (I just want to no-op)..  Is there an easy way to run
> > > AR in "test mode" or do I have to abstract all the calls that actually
> > > touch the DB.  Thanks!
> >
> > > Mike
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to