Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
On Tue, Aug 23, 2011 at 6:22 AM, Gordon Yeong wrote: > I found out why it was not working. > > The line, 'Part.should_receive(:update_attributes).with('title' => 'Brake > pads').and_return(part)' should not be there because the controller specs > should not care about implementation (ie. how thin

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
On Tue, Aug 23, 2011 at 6:11 AM, Gordon Yeong wrote: > >> Do you have a before filter somewhere that is preventing the >> :update_attributes message from being received? >> >> I have checked my application's controllers > (app/controllers/application_controller.rb and > app/controllers/parts_co

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Ken Chien
I think you were closer when you had: --- Source code extract starts - context 'saves updates to an existing part object successfully' do before do part = double('part').stub(:update_ attributes).and_return(true) end it 'does its job in saving

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread David Chelimsky
On Aug 23, 2011, at 7:22 AM, Gordon Yeong wrote: > I found out why it was not working. > > The line, 'Part.should_receive(:update_attributes).with('title' => 'Brake > pads').and_return(part)' should not be there because the controller specs > should not care about implementation (ie. how things

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Gordon Yeong
> > > Do you have a before filter somewhere that is preventing the > :update_attributes message from being received? > > I have checked my application's controllers (app/controllers/application_controller.rb and app/controllers/parts_controller.rb) and controller spec (spec/controllers/parts_cont

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Gordon Yeong
I found out why it was not working. The line, 'Part.should_receive(:update_attributes).with('title' => 'Brake pads').and_return(part)' should not be there because the controller specs should not care about implementation (ie. how things are processed, rather just what is done). I realised this wh

Re: [rspec-users] Route is valid but not found :(

2011-08-23 Thread Justin Ko
Sent from my iPhone On Aug 22, 2011, at 10:14 PM, ct9a wrote: > > > On Aug 23, 1:55 pm, Justin Ko wrote: >> On Mon, Aug 22, 2011 at 9:09 PM, ct9a wrote: >> >>> Thanks, Justin. >> >>> I have the part object mocked up before each spec runs. >> >>> --- Extract begins -

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread ct9a
On Aug 23, 1:55 pm, Justin Ko wrote: > On Mon, Aug 22, 2011 at 9:09 PM, ct9a wrote: > > > Thanks, Justin. > > > I have the part object mocked up before each spec runs. > > > --- Extract begins - > > >    let(:part){ > >        mock_model('Part').as_null_object > >    } > > >

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread Justin Ko
On Mon, Aug 22, 2011 at 9:09 PM, ct9a wrote: > > > Thanks, Justin. > > I have the part object mocked up before each spec runs. > > --- Extract begins - > >let(:part){ >mock_model('Part').as_null_object >} > >before do >Part.stub(:new).and_return(par

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread ct9a
Thanks, Justin. I have the part object mocked up before each spec runs. --- Extract begins - let(:part){ mock_model('Part').as_null_object } before do Part.stub(:new).and_return(part) end --- Extract ends - With that i

Re: [rspec-users] Route is valid but not found :(

2011-08-22 Thread Justin Ko
On Mon, Aug 22, 2011 at 12:14 AM, ct9a wrote: > Hi, guys, > > After reading the rspec book (dec 2010 edition), I went on to write > controller specs for an application I'm porting over from rails 2.3.x > to rails 3. > > > 1) I ran 'rake routes' and got the following: > >parts GET/parts(.