Re: [jasmine-js] Can a failing expectation end a spec?

28 views
Skip to first unread message

Davis W. Frank

unread,
Jul 12, 2012, 12:45:14 AM7/12/12
to jasmi...@googlegroups.com
There is now way to do this today.

There's a feature request for this and I think a story in the backlog for it.

--dwf

On Tue, Jul 10, 2012 at 8:30 PM, Doug Reeder <reed...@gmail.com> wrote:
I've got a spec that includes

expect(jig.webXhr.status).toBe(200);

expect(jig.webXhr.getResponseHeader("Content-Type")).toBe("text/html");

expect(jig.webResponse).toMatch(/<title>Zap Photoshare/);


Is there a way to specify that, if the first expect() fails, no other expects in this spec should be run?

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To view this discussion on the web visit https://groups.google.com/d/msg/jasmine-js/-/Bt7vh8Zd_4IJ.
To post to this group, send email to jasmi...@googlegroups.com.
To unsubscribe from this group, send email to jasmine-js+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jasmine-js?hl=en.



--
thx,
--dwf

Aaron Mcleod

unread,
Jul 12, 2012, 8:02:16 AM7/12/12
to jasmi...@googlegroups.com
You should probably put them in separate it blocks. Keep one expectation per test. That way you will see which fails and which succeeds

Sent from my iPhone

Doug Reeder

unread,
Jul 12, 2012, 4:40:45 PM7/12/12
to jasmi...@googlegroups.com
I separate expectations to the extent possible, but if the server doesn't return 200 OK, there's no point checking the response body.

For now I've enclosed the latter expectations in an if statement, which works, but is ugly.


-- Sent from my Palm Pre 2


Reply all
Reply to author
Forward
0 new messages