Copy-paste and tweak to implement argument expectations

This commit is contained in:
Michael Miller 2019-11-03 14:48:08 -07:00
parent 4acf6aaa58
commit 82e01e44de
2 changed files with 7 additions and 2 deletions

View file

@ -314,8 +314,8 @@ Items not marked as completed may have partial implementations.
- [X] Doubles (Stand-ins for real types) - `double NAME { }` - [X] Doubles (Stand-ins for real types) - `double NAME { }`
- [X] Method stubs - `allow().to receive()`, `allow().to receive().and_return()` - [X] Method stubs - `allow().to receive()`, `allow().to receive().and_return()`
- [ ] Spies - `expect().to receive()` - [ ] Spies - `expect().to receive()`
- [ ] Message expectations - `expect().to receive().at_least()` - [X] Message expectations - `expect().to receive().at_least()`
- [ ] Argument expectations - `expect().to receive().with()` - [X] Argument expectations - `expect().to receive().with()`
- [ ] Message ordering - `expect().to receive().ordered` - [ ] Message ordering - `expect().to receive().ordered`
- [ ] Null doubles - [ ] Null doubles
- [ ] Runner - [ ] Runner

View file

@ -38,6 +38,11 @@ module Spectator::Matchers
} }
end end
def with(*args, **opts)
args = Mocks::GenericArguments.new(args, opts)
ReceiveArgumentsMatcher.new(@expected, args, @range)
end
def once def once
ReceiveMatcher.new(@expected, (1..1)) ReceiveMatcher.new(@expected, (1..1))
end end