4 ms·
Really enjoyed this article. Fascinating to see the resistance to testing back when he started, and how he used a bit of clever marketing to change the way peop
by LAC-Tech 6y ago
Really enjoyed this article. Fascinating to see the resistance to testing back when he started, and how he used a bit of clever marketing to change the way people thought about it.
Interesting that he's very happy with
expect(expected).to.equal(actual)
I wonder if `assert` or `check` or even `test` makes us think differently about what we're doing (in the assertion itself, not in the method name to set up the test).
- srbaker 6y agoI think this format is the logical conclusion, and improvement over, mixing what are effectively global assertions on to every object. The ideal is a single method (call it `assert` if you want) that takes a block, and does the right thing, is the overall best.
- FrancoisBosun 6y agoJim Weirich wrote rspec-given. This gem allows one to write really nice assertions: Given { @stack = Stack.new } When { @stack.push(1) } Then { @stack.peek == 1 } And { @stack.size == 1 } What you wish for is embedded in When and And. Check it out: https://github.com/jimweirich/rspec-given https://github.com/jimweirich/rspec-given
- jamie_ca 6y agoThe biggest benefit in my mind of rspec-given is that it allows you to combine the speed benefits of running the test setup once (When) with the clarity of granular assertions that report failures independently (Then).