Class: Sus::Registry
- Inherits:
-
Object
- Object
- Sus::Registry
- Defined in:
- lib/sus/registry.rb
Overview
Represents a registry of test files and contexts.
Constant Summary collapse
- DIRECTORY_GLOB =
The glob pattern used to find Ruby files in directories.
"**/*.rb"
Instance Attribute Summary collapse
-
#base ⇒ Object
readonly
Returns the value of attribute base.
Instance Method Summary collapse
-
#call(assertions = Assertions.default) ⇒ Object
Execute all tests in the registry.
- #children ⇒ Object
-
#each ⇒ Object
Iterate over all test cases in the registry.
-
#initialize(**options) ⇒ Registry
constructor
Initialize a new registry.
-
#load(path) ⇒ Object
Load a test file or directory.
-
#print(output) ⇒ Object
Print a representation of this registry.
- #The base test context class.=(basetestcontext) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#base ⇒ Object (readonly)
Returns the value of attribute base.
35 36 37 |
# File 'lib/sus/registry.rb', line 35 def base @base end |
Instance Method Details
#call(assertions = Assertions.default) ⇒ Object
Execute all tests in the registry.
73 74 75 76 77 |
# File 'lib/sus/registry.rb', line 73 def call(assertions = Assertions.default) @base.call(assertions) return assertions end |
#children ⇒ Object
86 87 88 |
# File 'lib/sus/registry.rb', line 86 def children @base.children end |
#each ⇒ Object
Iterate over all test cases in the registry.
81 82 83 |
# File 'lib/sus/registry.rb', line 81 def each(...) @base.each(...) end |
#load(path) ⇒ Object
Load a test file or directory.
50 51 52 53 54 55 56 |
# File 'lib/sus/registry.rb', line 50 def load(path) if ::File.directory?(path) load_directory(path) else load_file(path) end end |
#print(output) ⇒ Object
Print a representation of this registry.
39 40 41 |
# File 'lib/sus/registry.rb', line 39 def print(output) output.write("Test Registry") end |
#The base test context class.=(basetestcontext) ⇒ Object
35 |
# File 'lib/sus/registry.rb', line 35 attr :base |
#to_s ⇒ Object
44 45 46 |
# File 'lib/sus/registry.rb', line 44 def to_s @base&.identity&.to_s || self.class.name end |