[rspec-users] Using Mock / Datamapper / Associations
akleak at gmail.com
Fri Nov 13 13:04:52 EST 2009
I'm using datamapper and have two associated classes:
- Org - has n, :users
- User - belongs_to :org
When I test the User object, I have been able to mock/stub methods of
the Org object. Great!
But - I still need to require 'org.rb' to setup my user tests -
otherwise Datamapper will complain: "Cannot find the parent_model Org
for User in org (NameError)"
Sure I can require the associated object in my test setup, but would
love to avoid having to do this, as it increases complexity as the
number of associated classes grows.
Is there a way to mock the Org object, without having to require it in
my test setup ??
More information about the rspec-users