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
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
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
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
>
>
> 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
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
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 -
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
> > }
>
> >
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
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
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(.
11 matches
Mail list logo