It looks like line 27 <https://gist.github.com/himadriganguly/e1547a512ff54084932d#file-readers_controller_spec-rb-L27> should be double(Reader) instead of allow(Reader).
allow returns a mock expectation, not the object to mock. Additionally, line 37 <https://gist.github.com/himadriganguly/e1547a512ff54084932d#file-readers_controller_spec-rb-L37> will overwrite the stub you created on line 36 <https://gist.github.com/himadriganguly/e1547a512ff54084932d#file-readers_controller_spec-rb-L36>; meaning that it will return nil. Add the .and_return(reader) to line 37 and delete line 36. Hope that helps. On Mon, Jul 28, 2014 at 10:16 AM, Joy Ganguly <[email protected]> wrote: > Running Rspec giving error > > undefined method `save' for #<RSpec::Mocks::AllowanceTarget:0x9bfadd4> > > and here is my code and error details > https://gist.github.com/himadriganguly/e1547a512ff54084932d > > Thanks to all in advance. > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/3b2a5bb2-0ef5-4843-9589-0f6d995958d2%40googlegroups.com > <https://groups.google.com/d/msgid/rspec/3b2a5bb2-0ef5-4843-9589-0f6d995958d2%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAKCESdjnUTh3Ysmo63ShPp9F-%3DJFMSWgfaWkHRiCRKTAqctDOw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
