mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Don't automatically extend StubbedType
Mocked module includes StubbedType, which doesn't pass along functionality to mocks.
This commit is contained in:
parent
aa87d124e4
commit
22a37d38f9
3 changed files with 7 additions and 11 deletions
|
@ -3,6 +3,7 @@ require "./method_call"
|
||||||
require "./stub"
|
require "./stub"
|
||||||
require "./stubbable"
|
require "./stubbable"
|
||||||
require "./stubbed_name"
|
require "./stubbed_name"
|
||||||
|
require "./stubbed_type"
|
||||||
require "./unexpected_message"
|
require "./unexpected_message"
|
||||||
require "./value_stub"
|
require "./value_stub"
|
||||||
|
|
||||||
|
@ -18,6 +19,7 @@ module Spectator
|
||||||
# New methods are not defines when a stub is added that doesn't have a matching method name.
|
# New methods are not defines when a stub is added that doesn't have a matching method name.
|
||||||
abstract class Double
|
abstract class Double
|
||||||
include Stubbable
|
include Stubbable
|
||||||
|
extend StubbedType
|
||||||
|
|
||||||
Log = Spectator::Log.for(self)
|
Log = Spectator::Log.for(self)
|
||||||
|
|
||||||
|
@ -65,6 +67,10 @@ module Spectator
|
||||||
|
|
||||||
@calls = [] of MethodCall
|
@calls = [] of MethodCall
|
||||||
|
|
||||||
|
private class_getter _spectator_stubs : Array(Stub) = [] of Stub
|
||||||
|
|
||||||
|
class_getter _spectator_calls : Array(MethodCall) = [] of MethodCall
|
||||||
|
|
||||||
# Creates the double.
|
# Creates the double.
|
||||||
#
|
#
|
||||||
# An initial set of *stubs* can be provided.
|
# An initial set of *stubs* can be provided.
|
||||||
|
|
|
@ -2,7 +2,6 @@ require "../dsl/reserved"
|
||||||
require "./arguments"
|
require "./arguments"
|
||||||
require "./method_call"
|
require "./method_call"
|
||||||
require "./stub"
|
require "./stub"
|
||||||
require "./stubbed_type"
|
|
||||||
require "./typed_stub"
|
require "./typed_stub"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
|
@ -384,14 +383,5 @@ module Spectator
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Automatically extend `StubbedType` when a type is made stubbable.
|
|
||||||
macro included
|
|
||||||
extend StubbedType
|
|
||||||
|
|
||||||
private class_getter _spectator_stubs : Array(::Spectator::Stub) = [] of ::Spectator::Stub
|
|
||||||
|
|
||||||
class_getter _spectator_calls : Array(::Spectator::MethodCall) = [] of ::Spectator::MethodCall
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,7 +4,7 @@ require "./stub"
|
||||||
module Spectator
|
module Spectator
|
||||||
# Defines stubbing functionality at the type level (classes and structs).
|
# Defines stubbing functionality at the type level (classes and structs).
|
||||||
#
|
#
|
||||||
# This module is intended to be extended from when a type includes `Stubbable`.
|
# This module is intended to be extended when a type includes `Stubbable`.
|
||||||
module StubbedType
|
module StubbedType
|
||||||
private abstract def _spectator_stubs : Array(Stub)
|
private abstract def _spectator_stubs : Array(Stub)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue