Simplify macro eval by returning a lazy double

This commit is contained in:
Michael Miller 2022-03-31 18:54:39 -06:00
parent 914def05e1
commit c1195ef687
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
2 changed files with 6 additions and 1 deletions

View file

@ -56,5 +56,10 @@ Spectator.describe "Lazy double DSL" do
dbl = double
expect { dbl.oops }.to raise_error(Spectator::UnexpectedMessage, /anonymous/i)
end
it "accepts no name and predefined responses" do
dbl = double(foo: 42)
expect(dbl.foo).to eq(42)
end
end
end

View file

@ -125,7 +125,7 @@ module Spectator::DSL
# expect(dbl.foo).to eq(42)
# ```
macro double(**value_methods)
new_double({{**value_methods}})
::Spectator::LazyDouble.new({{**value_methods}})
end
end
end