mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add stub when using expect().to receive()
This appears to match RSpec's behavior.
This commit is contained in:
parent
384fb3093f
commit
23fd075d51
1 changed files with 6 additions and 2 deletions
|
@ -79,11 +79,15 @@ module Spectator::Mocks
|
|||
end
|
||||
|
||||
def expect(object, stub : MethodStub) : Nil
|
||||
fetch_instance(object).expected.add(stub)
|
||||
entry = fetch_instance(object)
|
||||
entry.expected.add(stub)
|
||||
entry.stubs.unshift(stub)
|
||||
end
|
||||
|
||||
def expect(type : T.class, stub : MethodStub) : Nil forall T
|
||||
fetch_type(type).expected.add(stub)
|
||||
entry = fetch_type(type)
|
||||
entry.expected.add(stub)
|
||||
entry.stubs.unshift(stub)
|
||||
end
|
||||
|
||||
private def fetch_instance(object)
|
||||
|
|
Loading…
Reference in a new issue