[LRUG] Writing readable feature tests with RSpec

Scott Matthewman scott at evvnt.com
Thu Jul 31 03:00:51 PDT 2014


On 31 July 2014 10:51, Frederick Cheung <frederick.cheung at gmail.com> wrote:

> Which is why rspec 3 removed be_true (and replaced it with be_truthy)
>

In our own tests, when we're unit testing methods that are expected to
return a Boolean, we use `eq(true)`, etc. to guarantee we're getting a
genuine Boolean result back. If we're using Ruby's "anything non-nil
evaluates to true" in conditionals, etc., we're more concerned with the
higher-level outcome of those decision tress. So be_truthy and be_falsy
shouldn't appear in our test suite.

...In theory, at least. In practice, I just did a quick search and a couple
have snuck in after our recent upgrade from Rspec 3.0beta to release.
Oopsie.

-- 
Scott Matthewman
Lead Developer

T:  + 44 20 7323 0053
M: + 44 781 844 5270
E: scott at evvnt.com
W: evvnt.com
L: uk.linkedin.com/in/scottmatthewman/

*Superior Event Marketing -* You submit once, we submit everywhere that
matters
evvnt <http://evvnt.com/>* | *linkedin
<http://www.linkedin.com/company/evvnt>* | **facebook
<https://www.facebook.com/evvnt>* *| *twitter <https://twitter.com/evvnt>

What do we do: http://youtu.be/pqoZ8ge1PH4
Testimonials: http://evvnt.com/testimonials/
Media Pack:
http://evvnt.com/conference-exhibition-media-pack-event-marketing
Case Study: http://evvnt.com/2013/03/case-study-ubm-canon/

*evvnt Ltd* :: London Office: 83 Great Titchfield Street, London, W1W 6RH
Registered in England, No: 8062041 - VAT 135069029
Registered Office: Unit 11 Hove Business Centre, Fonthill Road, Hove, East
Sussex, BN3 6HA, UK

This message, its contents and any attachments are private, confidential
and may contain information that is subject to copyright and/or legal
privilege. You may not disclose, use or disseminate all or part of this
message without our prior written consent. If you are not the intended
recipient, please notify us immediately by replying to this message and
then delete it from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20140731/d2eb11a5/attachment-0003.html>


More information about the Chat mailing list