RSpec

  • Avoid using let and let!

They usually make you shared the thing across multiple tests. Result in convoluted tests and mystery guest.

  • Separate testing phases with newlines.

Keep this consistently make your tests much easier to read.

  • Use RSpec's expect syntax

  • Use describe, context, it

  • Prefer not_to over to_not

  • Use have_css, have_text with Capybara

  • Avoid using shared_examples

Which line it was testing will become hard to tell.

  • Use More Ruby, less RSpec