Use different value than original

This commit is contained in:
Michael Miller 2022-10-09 16:58:56 -06:00
parent bc0a9c03c9
commit c6afa0adb3
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF

View file

@ -167,13 +167,13 @@ Spectator.describe "Deferred stub expectation DSL" do
pre_condition { expect(fake).to_not have_received(:foo), "Leaked method calls from previous examples" } pre_condition { expect(fake).to_not have_received(:foo), "Leaked method calls from previous examples" }
it "matches when a message is received" do it "matches when a message is received" do
expect(fake).to receive(:foo).and_return(42) expect(fake).to receive(:foo).and_return(0)
fake.foo(:bar) fake.foo(:bar)
end end
it "returns the correct value" do it "returns the correct value" do
expect(fake).to receive(:foo).and_return(42) expect(fake).to receive(:foo).and_return(0)
expect(fake.foo).to eq(42) expect(fake.foo).to eq(0)
end end
it "matches when a message isn't received" do it "matches when a message isn't received" do
@ -181,12 +181,12 @@ Spectator.describe "Deferred stub expectation DSL" do
end end
it "matches when a message is received with matching arguments" do it "matches when a message is received with matching arguments" do
expect(fake).to receive(:foo).with(:bar).and_return(42) expect(fake).to receive(:foo).with(:bar).and_return(0)
fake.foo(:bar) fake.foo(:bar)
end end
it "matches when a message without arguments is received" do it "matches when a message without arguments is received" do
expect(fake).to_not receive(:foo).with(:bar).and_return(42) expect(fake).to_not receive(:foo).with(:bar).and_return(0)
fake.foo fake.foo
end end
@ -195,7 +195,7 @@ Spectator.describe "Deferred stub expectation DSL" do
end end
it "matches when a message with arguments isn't received" do it "matches when a message with arguments isn't received" do
expect(fake).to_not receive(:foo).with(:baz).and_return(42) expect(fake).to_not receive(:foo).with(:baz).and_return(0)
fake.foo(:bar) fake.foo(:bar)
end end
end end