Re: [rspec] expecting <"new"> but rendering with <[]>

385 views
Skip to first unread message

Aaron Kromer

unread,
Aug 1, 2014, 10:27:29 AM8/1/14
to rs...@googlegroups.com

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 <tech.tu...@gmail.com> 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 rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/ada49a05-b4df-49be-b2e2-d2bb6f2d6745%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages