RSpec

Behaviour Driven Development for Ruby. Making TDD Productive and Fun.

Recipes

Continuous testing

Videos

Quick guide by @masylum

1
2
3
4
5
6
7
8
9
10
let_it_be(...) # => All the common immutable stuff

let + before(...) # => All the mutable stuff. This are things that are going to change in contexts

subject

it # => test the happy path

context # => Alter my `let`s and `before`s from the happy paths and test those new conditions
it

Mocking

  • timecop - A gem providing “time travel”, “time freezing”, and “time acceleration” capabilities, making it simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
  • vcr - Record your test suite’s HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests. http://relishapp.com/vcr/vcr

Test data

Transactions

Comments

⬆︎TOP