mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add intermediate TypedStub
This commit is contained in:
parent
dc74a741cf
commit
8e38d3b054
2 changed files with 14 additions and 2 deletions
12
src/spectator/mocks/typed_stub.cr
Normal file
12
src/spectator/mocks/typed_stub.cr
Normal file
|
@ -0,0 +1,12 @@
|
|||
require "./stub"
|
||||
|
||||
module Spectator
|
||||
# Abstract type of stub that identifies the type of value produced by a stub.
|
||||
#
|
||||
# *T* is the type produced by the stub.
|
||||
# How the stub produces this value is up to subclasses.
|
||||
abstract class TypedStub(T) < Stub
|
||||
# Return value.
|
||||
abstract def value : T
|
||||
end
|
||||
end
|
|
@ -1,9 +1,9 @@
|
|||
require "./arguments"
|
||||
require "./stub"
|
||||
require "./typed_stub"
|
||||
|
||||
module Spectator
|
||||
# Stub that responds with a static value.
|
||||
class ValueStub(T) < Stub
|
||||
class ValueStub(T) < TypedStub(T)
|
||||
# Return value.
|
||||
getter value : T
|
||||
|
||||
|
|
Loading…
Reference in a new issue