Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread s.ross
I left out a key piece of my spec code in the original question: before(:each) do @category = mock_model(Category) Category.should_receive(:find).any_number_of_times.and_return (@category) @image = mock_model(Image) @image_category = mock_model(ImageCategory) end For th

Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread Zach Dennis
Actually better then an exception On 8/23/07, Zach Dennis <[EMAIL PROTECTED]> wrote: > On 8/23/07, Daniel N <[EMAIL PROTECTED]> wrote: > > > > > > > > On 8/24/07, Courtenay <[EMAIL PROTECTED]> wrote: > > > Does this work? > > > > > >Image.stub!(:validates_uniqueness_of).and_return(true) > > >

Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread Pat Maddox
On 8/23/07, s.ross <[EMAIL PROTECTED]> wrote: > I want to use mocks and stubs to test the controller, but am having > trouble getting my validation not to trigger. Here's the code: > > # spec: > > Image.stub!(:find).and_return(@image) > @image.should_receive(:save!).once.with(:any_args) >

Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread Zach Dennis
On 8/23/07, Daniel N <[EMAIL PROTECTED]> wrote: > > > > On 8/24/07, Courtenay <[EMAIL PROTECTED]> wrote: > > Does this work? > > > >Image.stub!(:validates_uniqueness_of).and_return(true) > > > > > > On 8/23/07, s.ross <[EMAIL PROTECTED]> wrote: > > > I want to use mocks and stubs to test the co

Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread Daniel N
On 8/24/07, Courtenay <[EMAIL PROTECTED]> wrote: > > Does this work? > >Image.stub!(:validates_uniqueness_of).and_return(true) > > > On 8/23/07, s.ross <[EMAIL PROTECTED]> wrote: > > I want to use mocks and stubs to test the controller, but am having > > trouble getting my validation not to tri

Re: [rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread Courtenay
Does this work? Image.stub!(:validates_uniqueness_of).and_return(true) On 8/23/07, s.ross <[EMAIL PROTECTED]> wrote: > I want to use mocks and stubs to test the controller, but am having > trouble getting my validation not to trigger. Here's the code: > > # spec: > > Image.stub!(:find).a

[rspec-users] controller spec with model that validates_uniqueness

2007-08-23 Thread s.ross
I want to use mocks and stubs to test the controller, but am having trouble getting my validation not to trigger. Here's the code: # spec: Image.stub!(:find).and_return(@image) @image.should_receive(:save!).once.with(:any_args) put :update, :id => @image.id, :category_id => @ca