diff --git a/spec/spectator/dsl/mocks/lazy_double_spec.cr b/spec/spectator/dsl/mocks/lazy_double_spec.cr index 6c1fb26..82a6612 100644 --- a/spec/spectator/dsl/mocks/lazy_double_spec.cr +++ b/spec/spectator/dsl/mocks/lazy_double_spec.cr @@ -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 diff --git a/src/spectator/dsl/mocks.cr b/src/spectator/dsl/mocks.cr index b5b99ee..377da5b 100644 --- a/src/spectator/dsl/mocks.cr +++ b/src/spectator/dsl/mocks.cr @@ -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