[LRUG] Writing readable feature tests with RSpec

Kerry Buckley kerryjbuckley at gmail.com
Thu Jul 31 02:37:57 PDT 2014


 
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

Kerry



More information about the Chat mailing list