Chris Roos by Chris Roos

Show and Tell 39

Tom S and Ben G joined James and I for our 39th Show & Tell in Dec 2017.


RSpec’s Verifying Doubles

Tom talking about Verifying Doubles

Tom explained how he updated the FutureLearn tests to use RSpec’s Verifying Doubles after a recent upgrade to RSpec 3. Verifying Doubles are similar to standard doubles but with the added benefit of verifying that the stubbed methods exist on the object they’re being stubbed on.

Tom’s using the instance_double('Foo') syntax (as opposed to instance_double(Foo)) which toggles verification based on whether the Foo constant is defined. This allows the tests to run quickly in isolation but with the added benefit of verification when run in the context of the application (i.e. when all the dependencies are loaded).

Tom’s ended up disabling verification in their Rails view specs. There were a number of tests that he couldn’t get to work with double verification. He initially disabled verification for those tests (using without_partial_double_verification) but decided that the cost of having to think about when to disable it didn’t justify the benefit of having it enabled.

Shortly after merging the changes to master they caught a problem that would’ve otherwise probably made it to production. A column was renamed in a migration which broke some code making use of find_by_<old_column_name>. This find_by method was being stubbed in a test which would’ve continued to pass had the double verification not complained about the unknown method.

The discussion reminded James M of OO-Matron by Nat Pryce, although I’m afraid I no longer recall what the similarities were.


Teaching 3D

Ben talking about 3D rendering

Ben spoke about an alternative way of teaching people about 3D modelling. Unfortunately, because the event was 6 months ago and because of my lack of subject knowledge, my notes no longer make any sense to me and so I’m not going to be able to do this any justice. Sorry, Ben!

If you have any feedback on this article, please get in touch!

Historical comments can be found here.

Recent