Add let! alias method 'make'.
Created by: yazumoto
RSpec's let
and let!
is a bit confusing when you writing specs which need to have some let and let! together.
For example,
let!(:test1) { create(:sample, name: 'test1') }
let(:test2) { create(:sample, name: 'test2') }
let(:test3) { create(:sample, name: 'test3') }
This code create test1 before spec run but create test2 and test3 when spec call them. This cause us confused. So, we sometimes make rules like 'Cannot use let!, use before if you need`.
So, I make a alias method of let!. Then it will be like this.
make(:test1) { create(:sample, name: 'test1') }
let(:test2) { create(:sample, name: 'test2') }
let(:test3) { create(:sample, name: 'test3') }
This code is easy to understand its behavior.