This is due to not telling the Reader class object that it needs to return your stub when new is called for that spec. "mocks" and "stubs" are ways to tell objects to return specific responses. If you haven't had a chance yet, give a read through the main page of rspec-mocks here: https://www.relishapp.com/rspec/rspec-mocks/v/3-0/docs
After that, the section on the basics ( https://www.relishapp.com/rspec/rspec-mocks/v/3-0/docs/basics) is very good. The team did a lot of awesome work updating all of these docs. Mocks / stubs can be one of the more confusing parts of testing. Using them with Rails is more confusing due to the opinions that Rails has established on how it's framework should be written. I don't have any great resources to provide right now, hopefully that will change in the future. :-/ On Fri, Aug 1, 2014 at 10:11 AM, Joy Ganguly <[email protected]> wrote: > While running RSpec i am getting this error > > Failure/Error: expect(response).to render_template(:new) > expecting <"new"> but rendering with <[]> > > I am new to RSpec and trying to learn it. I am also having problem > understanding mock and stub in RSpec, which is now allow and double in RSpec > 3.0. > > 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/ada49a05-b4df-49be-b2e2-d2bb6f2d6745%40googlegroups.com > <https://groups.google.com/d/msgid/rspec/ada49a05-b4df-49be-b2e2-d2bb6f2d6745%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/CAKCESdg8LV2-_s1mk8WtX_CojS6UiCPdhSAtPAMJeU84wofyRg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
