A Ruby spec defines 3 instance_doubles:
let(:doub1) { instance_double(Foo) }
let(:doub2) { instance_double(Foo) }
let(:doub3) { instance_double(Foo) }
A shared_example seeks to ensure a collaborator is used with any of the instance_doubles:
shared_examples :a_consumer_of_bars do
it "passes a Foo to the BarGetter" do
expect(BarGetter).to receive(:fetch_bar)
.with((condition1 || condition2 || condition3)).at_least(:once)
subject
end
end
The (piped||arguments||approach) does not work. Is there an existing rspec matcher for checking whether an argument matches an element of an array? Or is writing a custom matcher the way to go?