mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Verify that initial stubs can be overridden
This commit is contained in:
parent
978e6c3625
commit
d74bc76687
1 changed files with 9 additions and 2 deletions
|
@ -37,8 +37,15 @@ Spectator.describe Spectator::Mock do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "allows methods to be stubbed" do
|
it "allows methods to be stubbed" do
|
||||||
stub = Spectator::ValueStub.new(:method3, "stubbed")
|
stub1 = Spectator::ValueStub.new(:method1, 777)
|
||||||
expect { thing._spectator_define_stub(stub) }.to change { thing.method3 }.from("original").to("stubbed")
|
stub2 = Spectator::ValueStub.new(:method2, :override)
|
||||||
|
stub3 = Spectator::ValueStub.new(:method3, "stubbed")
|
||||||
|
|
||||||
|
aggregate_failures do
|
||||||
|
expect { thing._spectator_define_stub(stub1) }.to change { thing.method1 }.to(777)
|
||||||
|
expect { thing._spectator_define_stub(stub2) }.to change { thing.method2 }.to(:override)
|
||||||
|
expect { thing._spectator_define_stub(stub3) }.to change { thing.method3 }.from("original").to("stubbed")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue