Look into creating an equivalent of let.
RSpec's let defines a memoized helper method, which is lazy-evaluated but returns the same value for each example in the group. That means all descendants of a particular subgroup get the same value, and different subgroups each get different values for their descendants.
let! is evaluated immediately, and is described as for values that need to be available for hooks.
This is different from using plain local variables, which would be instantiated when the spec is evaluated (unless they're lazy) and the same value is provided to everything in the scope.
Look into creating an equivalent of
let.RSpec's
letdefines a memoized helper method, which is lazy-evaluated but returns the same value for each example in the group. That means all descendants of a particular subgroup get the same value, and different subgroups each get different values for their descendants.let!is evaluated immediately, and is described as for values that need to be available for hooks.This is different from using plain local variables, which would be instantiated when the spec is evaluated (unless they're lazy) and the same value is provided to everything in the scope.