Skip to content

Allow let to memoize similar methods in a single block by passing multiple arguments

gitlab-qa-bot requested to merge github/fork/p8/master into master

Created by: p8

For some specs I want to instantiate similar but distinct objects. But instead of doing:

let(:thing) do
   thing = Thing.new
   thing.do_something
   thing
end

let(:another_thing) do
   thing = Thing.new
   thing.do_something
   thing
end

I'd like to be able to do:

let(:thing, :another_thing) do
   thing = Thing.new
   thing.do_something
   thing
end

Merge request reports