Re: [rspec-users] How to mock an association

2008-02-14 Thread Bryan Ray
I don't know exactly how you're using the code, but validates_presence_of :user_id seems redundant. If you've setup a relationship from Group to User then Active Record will be enforcing that validation for you. Just a thought ... Other than that you would probably do (without seeing any of your c

Re: [rspec-users] How to mock an association

2008-02-11 Thread Edvard Majakari
> Obvious 'rails mocking associations' seemed to work for me, unless I ...make that '...Googling for ...'. Duh. -- "One day, when he was naughty, Mr Bunnsy looked over the hedge into Farmer Fred's field and it was full of fresh green lettuces. Mr Bunnsy, however, was not full of lettuces. This d

Re: [rspec-users] How to mock an association

2008-02-11 Thread Edvard Majakari
On Feb 11, 2008 1:43 PM, Wes Shaddix <[EMAIL PROTECTED]> wrote: > I've got a "group" model that has a user_id attribute and a > validates_existence_of :user and validates_presence_of :user_id > validations. What method(s) do I need to stub on the User mock to > intercept those validation calls? My

[rspec-users] How to mock an association

2008-02-11 Thread Wes Shaddix
I've got a "group" model that has a user_id attribute and a validates_existence_of :user and validates_presence_of :user_id validations. What method(s) do I need to stub on the User mock to intercept those validation calls? My goal is to isolate the Group model from the User model. Thanks Wes