You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to castle-pro...@googlegroups.com
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
Mauricio Scheffer
unread,
Oct 17, 2009, 9:06:49 PM10/17/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Castle Project Users
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
Brian DeMarzo
unread,
Oct 20, 2009, 9:44:31 AM10/20/09
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Castle Project Users
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?
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to castle-pro...@googlegroups.com
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.