Re: [rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-09 Thread Frank J. Mattia
> >>> it "should explicitly set created_by" do > >>>  controller.stub(:current_user) { mock_user } > >>>  mock_order.should_receive(:created_by=).with(mock_user) > >>>  post :create > >>> end > > >>> This is my newly working spec. Does this look well thought out or is > >>> there some glaring pitfa

Re: [rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-09 Thread Frank J. Mattia
> > > Seems reasonable to me. You could test with either an interaction based > > > approach (use mocks and stubs to confirm that @object receives the > > > "created_by" message with the expected param) or a state based approach > > > (hit the controller action and then inspect the system state aft

Re: [rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-08 Thread Frank J. Mattia
> Here's a stripped down excerpt from my controller spec. I know how > Order.should_receive(:method) works, but how do I translate that to an > instance variable? I've tried assigns(:order).should_receive to no > avail. Also, where do I put it? Above the post line won't work because > @order doesn'

Re: [rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-08 Thread Frank J. Mattia
> > My controller does something like this for create > > @object = Object.new(params[:object]) > > @object.created_by = current_user > > if @object.save... yadda yadda yadda... > > > I have my model spec testing for the presence of created_by but I feel > > compelled to test that my controller is

[rspec-users] (rspec2/rails3) spec'ing the details of a controller that is not purely *skinny* by design.

2010-07-08 Thread Frank J. Mattia
Looks like I didn't read the instructions before posting... I'm hoping that the "moderator" is /dev/null - otherwise this might come up as a repost. Anyway. I want my controller to set certain attributes on #create and #update (mostly created_by, updated_by... etc.) -- implementing this is easy. T