← Back to Upcase

Telling a Story with Your Tests

A well-written test case tells a clear story, communicating the intent of code. Learn how to write expressive tests and why duplication isn't always a bad thing in your test cases.

This is a companion discussion topic for the original entry at https://thoughtbot.com/upcase/videos/telling-a-story-with-your-tests

Hi guys,

Can we get the Gemfile for this exercise cleaned up a bit?
I thinks it’s an overkill with the extras as skylight, capybara, capybara-webkit

1 Like

I agree with the cleanup of the cleanup exercise. Rails 5?

I realise it’s not the core lesson, but it’s little strange that the specs explicitly mention the after_save callback – this seems like testing implementation rather than behaviour?

Also, I’m curious why the Invitation factory defaults to nil for user and team? Shouldn’t instantiating it return a valid instance? (it would fail FactoryGirl.lint in its current form).

Why would doing
membership_to_promote = build_non_admin_membership
be preferable to something like
let(:non_admin_membership) { Membership.new(admin: false) }?

I think they are trying to make the tests more clearer… its ok to have duplication instead of using lets…