mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add getter for wrapped instance
This commit is contained in:
parent
b53e1b60d8
commit
abf7c8831c
3 changed files with 12 additions and 1 deletions
|
@ -1002,6 +1002,9 @@ module Spectator::DSL
|
||||||
@instance = {{wrapper_class_name.id}}.new(sample_values)
|
@instance = {{wrapper_class_name.id}}.new(sample_values)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Retrieves the underlying, wrapped instance.
|
||||||
|
getter instance
|
||||||
|
|
||||||
# Add the block's content if one was provided.
|
# Add the block's content if one was provided.
|
||||||
{% if block.is_a?(Block) %}
|
{% if block.is_a?(Block) %}
|
||||||
{{block.body}}
|
{{block.body}}
|
||||||
|
|
|
@ -14,6 +14,11 @@ module Spectator
|
||||||
"DUMMY"
|
"DUMMY"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Dummy instance.
|
||||||
|
def instance
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
# Dummy run that does nothing.
|
# Dummy run that does nothing.
|
||||||
def run_instance
|
def run_instance
|
||||||
raise "You shouldn't be running this."
|
raise "You shouldn't be running this."
|
||||||
|
|
|
@ -2,7 +2,7 @@ require "./example_component"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
# Base class for all types of examples.
|
# Base class for all types of examples.
|
||||||
# Concrete types must implement the `#run_inner` and `#what` methods.
|
# Concrete types must implement the `#run_inner`, `#what`, and `#instance` methods.
|
||||||
abstract class Example < ExampleComponent
|
abstract class Example < ExampleComponent
|
||||||
# Indicates whether the example has already been run.
|
# Indicates whether the example has already been run.
|
||||||
getter? finished = false
|
getter? finished = false
|
||||||
|
@ -10,6 +10,9 @@ module Spectator
|
||||||
# Group that the example belongs to.
|
# Group that the example belongs to.
|
||||||
getter group : ExampleGroup
|
getter group : ExampleGroup
|
||||||
|
|
||||||
|
# Retrieves the internal wrapped instance.
|
||||||
|
abstract def instance
|
||||||
|
|
||||||
# Runs the example code.
|
# Runs the example code.
|
||||||
# A result is returned, which represents the outcome of the test.
|
# A result is returned, which represents the outcome of the test.
|
||||||
# An example can be run only once.
|
# An example can be run only once.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue