mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
19 lines
488 B
Crystal
19 lines
488 B
Crystal
|
require "./context"
|
||
|
require "./context_method"
|
||
|
|
||
|
module Spectator
|
||
|
# Stores a test context and a method to call within it.
|
||
|
struct ContextDelegate
|
||
|
# Creates the delegate.
|
||
|
# The *context* is the instance of the test context.
|
||
|
# The *method* is proc that downcasts *context* and calls a method on it.
|
||
|
def initialize(@context : Context, @method : ContextMethod)
|
||
|
end
|
||
|
|
||
|
# Invokes a method in the test context.
|
||
|
def call
|
||
|
@method.call(@context)
|
||
|
end
|
||
|
end
|
||
|
end
|