[LRUG] Writing readable feature tests with RSpec
Frederick Cheung
frederick.cheung at gmail.com
Thu Jul 31 02:51:56 PDT 2014
On 31 July 2014 at 10:38:22, Kerry Buckley (kerryjbuckley at gmail.com) wrote:
>
> On 31 July 2014 at 10:28:51, Paul Battley (pbattley at gmail.com(mailto:pbattley at gmail.com))
> wrote:
> > To be clear, it's not the expect() part (that seems right and proper
> > and I'm glad they implemented it), but the "to be true" type of thing.
> > Intellectually, I know that a b c d is the same as a(b(c(d))), but it
> > doesn't feel idiomatic to me.
>
> I’ve never been particularly offended by rspec’s “magic”, but looking at your example
> another potential cause of confusion occurred to me, namely that these two expectations
> are not equivalent:
>
> expect(foo).to be_true # passes for anything truthy
> expect(foo).to be true # passes only if TrueClass === foo
>
Which is why rspec 3 removed be_true (and replaced it with be_truthy)
Fred
More information about the Chat
mailing list