Test Best Practices

TLDR Put your support in the support folder. Write each test with DRY guidelines.

Style Guidelines

  • Please review the style guidelines at ReachLocal ReachLocal RSpec Design Specs

    .

  • Describe describes a case

  • Context should have a positive and a negative case, or its a 'describe'

  • Use xit when you are temporarily in a test. If you are skipping a test and pushing to production use 'pending' with the rationale.

OMAlab increments on top of the standard RSPEC

  • Use todo method to define a task that needs done, but you aren't doing it yet. You can review todos by typing bin/todo.sh

Testing "levels"

  • Test the "happy path"

  • Test the "unhappy path"

  • Test the edge cases

  • Test for the bug fixes

Integration versus Unit tests

  • Tests go in spec/lib/etc. following the path

  • Integration tests go in the spec/integration folder

Examples

Fixing Mistakes

  • git filter-branch --index-filter 'git rm --cached --ignore-unmatch $1' HEAD~5..HEAD# removes the $1 file from last 5 commits (for large files)

Last updated