double
A simple object that stands in place of any other object.
(Think of stunt doubles)
Slide 3
Slide 3 text
instance_double
A simple object that stands in place of an object.
It verifies that the described double matches the object it stands for.
(Verifying double)
Slide 4
Slide 4 text
mock_model
A test double object expanded with ActiveModel and ActiveRecord API.
Includes real functionality of AM/AR methods.
Good for testing interactions with AR/AM objects.
Slide 5
Slide 5 text
stub_model
The real AR/AM object, with some mechanisms stubbed.
Builds on top of the existing models, uses the real app code.
Good for state-based tests.
WARNING: In some cases can result in the actual DB calls.
Slide 6
Slide 6 text
build_stubbed
The real AR object that's build with FactoryGirl.
If FactoryGirl defines dependencies they will be created.
Only persistence mechanisms are stubbed.