mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Test mock names
This commit is contained in:
parent
c98442e0ed
commit
847fd38534
1 changed files with 21 additions and 0 deletions
|
@ -92,6 +92,13 @@ Spectator.describe Spectator::Mock do
|
|||
expect(mock.method3).to eq("original")
|
||||
end
|
||||
end
|
||||
|
||||
it "sets the mock name" do
|
||||
args = Spectator::Arguments.capture("foo")
|
||||
stub = Spectator::ValueStub.new(:method3, 0, args)
|
||||
mock._spectator_define_stub(stub)
|
||||
expect { mock.method3 }.to raise_error(Spectator::UnexpectedMessage, /mock_name/), "Raised error doesn't contain the mocked name."
|
||||
end
|
||||
end
|
||||
|
||||
describe "#inject" do
|
||||
|
@ -146,6 +153,13 @@ Spectator.describe Spectator::Mock do
|
|||
it "doesn't affect instance variables" do
|
||||
expect(mock.instance_variables).to eq([:method1])
|
||||
end
|
||||
|
||||
it "sets the mock name" do
|
||||
args = Spectator::Arguments.capture("foo")
|
||||
stub = Spectator::ValueStub.new(:method3, 0, args)
|
||||
mock._spectator_define_stub(stub)
|
||||
expect { mock.method3 }.to raise_error(Spectator::UnexpectedMessage, /mock_name/), "Raised error doesn't contain the mocked name."
|
||||
end
|
||||
end
|
||||
|
||||
context "with a struct" do
|
||||
|
@ -183,6 +197,13 @@ Spectator.describe Spectator::Mock do
|
|||
it "doesn't affect instance variables" do
|
||||
expect(mock.instance_variables).to eq([:method1])
|
||||
end
|
||||
|
||||
it "sets the mock name" do
|
||||
args = Spectator::Arguments.capture("foo")
|
||||
stub = Spectator::ValueStub.new(:method3, 0, args)
|
||||
mock._spectator_define_stub(stub)
|
||||
expect { mock.method3 }.to raise_error(Spectator::UnexpectedMessage, /mock_name/), "Raised error doesn't contain the mocked name."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue