Always show expected and got values

21 views
Skip to first unread message

Michael Miro

unread,
Sep 12, 2016, 3:03:46 PM9/12/16
to rspec
Hi guys. I was wondering if there is an option to always show expected and got values even if tests passed. Google it already and checked the docs but nada. Anybody knows if it is possible to achieve?

Jon Rowe

unread,
Sep 12, 2016, 8:25:21 PM9/12/16
to rspec
There isn't a way to do this currently, but you could use custom matchers what surfaced the expected / actual values in the description which would almost do this.

Can I ask why you'd want to do this?

Michael Miro

unread,
Sep 13, 2016, 2:43:35 AM9/13/16
to rspec
I'm new to rspec and BDD at all so maybe I don't understand something but I would like to see not only that expected and got values match, but what are these values so I can see what my tests return. For example I was thinking that maybe my test passes but the matched got and expected values are not what I'am expecting them to be (and they are nil and nil for instance).

Jon Rowe

unread,
Sep 13, 2016, 3:13:38 AM9/13/16
to rs...@googlegroups.com
One for the core tenements of Test or Behaviour Driven Development, is the red green refactor cycle, if you’re worried about not having the right values for your actual values (those from the tests) then consider righting your tests to fail first, e.g. red, then making them green by changing your code only. That way you’ll see the actual values are correct before fixing the code to pass the tests.

Jon Rowe
---------------------------

--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/af93ff98-3cf3-47ba-862f-709a01a0f95f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Miro

unread,
Sep 13, 2016, 3:17:03 AM9/13/16
to rspec
That's a good point Jon! Thank's :)
Reply all
Reply to author
Forward
0 new messages