diff --git a/src/spectator/mocks/typed_stub.cr b/src/spectator/mocks/typed_stub.cr new file mode 100644 index 0000000..65c6c9b --- /dev/null +++ b/src/spectator/mocks/typed_stub.cr @@ -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 diff --git a/src/spectator/mocks/value_stub.cr b/src/spectator/mocks/value_stub.cr index 094ea57..9636a5b 100644 --- a/src/spectator/mocks/value_stub.cr +++ b/src/spectator/mocks/value_stub.cr @@ -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