Allow passing predefined stubs in as keyword args

This commit is contained in:
Michael Miller 2022-03-31 18:55:12 -06:00
parent c1195ef687
commit 9c1357da3f
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
4 changed files with 31 additions and 1 deletions

View file

@ -208,6 +208,16 @@ Spectator.describe "Double DSL" do
end
end
describe "predefined method stubs" do
double(:test8, foo: 42)
let(dbl) { double(:test8, foo: 7) }
it "overrides the original value" do
expect(dbl.foo).to eq(7)
end
end
describe "scope" do
double(:outer, scope: :outer)
double(:scope, scope: :outer)

View file

@ -176,4 +176,14 @@ Spectator.describe "Null double DSL" do
end
end
end
describe "predefined method stubs" do
double(:test8, foo: 42)
let(dbl) { double(:test8, foo: 7).as_null_object }
it "overrides the original value" do
expect(dbl.foo).to eq(7)
end
end
end