mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Disallow stubs for undefined methods in null double
Any method_missing invocation should return self.
This commit is contained in:
parent
7dd77a2096
commit
827b69483b
2 changed files with 4 additions and 27 deletions
|
@ -216,12 +216,12 @@ Spectator.describe Spectator::NullDouble do
|
|||
expect(dbl.foo("foobar")).to eq("bar")
|
||||
end
|
||||
|
||||
it "raises self when constraint unsatisfied" do
|
||||
it "raises when constraint unsatisfied" do
|
||||
expect { dbl.foo("baz") }.to raise_error(Spectator::UnexpectedMessage, /foo/)
|
||||
end
|
||||
|
||||
it "raises self when argument count doesn't match" do
|
||||
expect { dbl.foo }.to raise_error(Spectator::UnexpectedMessage, /foo/)
|
||||
it "returns self when argument count doesn't match" do
|
||||
expect(dbl.foo).to be(dbl)
|
||||
end
|
||||
|
||||
it "ignores the block argument if not in the constraint" do
|
||||
|
@ -406,15 +406,6 @@ Spectator.describe Spectator::NullDouble do
|
|||
it "removes previously defined stubs" do
|
||||
expect { dbl._spectator_clear_stubs }.to change { dbl.foo }.from(5).to(42)
|
||||
end
|
||||
|
||||
it "defaults to returning itself for methods with no implementation" do
|
||||
stub = Spectator::ValueStub.new(:baz, :xyz)
|
||||
dbl._spectator_define_stub(stub)
|
||||
expect(dbl.baz).to eq(:xyz)
|
||||
|
||||
dbl._spectator_clear_stubs
|
||||
expect(dbl.baz).to be(dbl)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#_spectator_calls" do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue