mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Test responses on inherited methods
This commit is contained in:
parent
d16c55984c
commit
75ccda0a86
1 changed files with 17 additions and 0 deletions
|
@ -140,5 +140,22 @@ Spectator.describe Spectator::Double do
|
|||
it "raises an error when argument count doesn't match" do
|
||||
expect { dbl.foo }.to raise_error(Spectator::UnexpectedMessage)
|
||||
end
|
||||
|
||||
context "with common object methods" do
|
||||
let(response) { Spectator::Response.new(:"same?", true, arguments).as(Spectator::AbstractResponse) }
|
||||
subject(dbl) { Spectator::Double({"same?": Bool}).new([response]) }
|
||||
|
||||
it "returns the response when constraint satisfied" do
|
||||
expect(dbl.same?("foobar")).to eq(true)
|
||||
end
|
||||
|
||||
it "raises an error when constraint unsatisfied" do
|
||||
expect { dbl.same?("baz") }.to raise_error(Spectator::UnexpectedMessage, /mask/)
|
||||
end
|
||||
|
||||
it "raises an error when argument count doesn't match" do
|
||||
expect { dbl.same? }.to raise_error(Spectator::UnexpectedMessage)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue