mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add filter to TestSuite
This commit is contained in:
parent
49c396714e
commit
2ff9505766
5 changed files with 32 additions and 18 deletions
|
@ -98,7 +98,7 @@ module Spectator
|
|||
# Builds the tests and runs the framework.
|
||||
private def run
|
||||
# Build the test suite and run it.
|
||||
suite = ::Spectator::DSL::Builder.build
|
||||
suite = ::Spectator::DSL::Builder.build(config.example_filter)
|
||||
Runner.new(suite, config).run
|
||||
rescue ex
|
||||
# Catch all unhandled exceptions here.
|
||||
|
|
|
@ -103,9 +103,9 @@ module Spectator::DSL
|
|||
|
||||
# Builds the entire spec and returns it as a test suite.
|
||||
# This should be called only once after the entire spec has been defined.
|
||||
protected def build : TestSuite
|
||||
protected def build(filter : ExampleFilter) : TestSuite
|
||||
group = root_group.build(Internals::SampleValues.empty)
|
||||
TestSuite.new(group)
|
||||
TestSuite.new(group, filter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,13 +6,14 @@ module Spectator
|
|||
|
||||
# Creates the test suite.
|
||||
# The example *group* provided will be run.
|
||||
def initialize(@group : ExampleGroup)
|
||||
# The *filter* identifies which examples to run from the *group*.
|
||||
def initialize(@group : ExampleGroup, @filter : ExampleFilter)
|
||||
end
|
||||
|
||||
# Yields each example in the test suite.
|
||||
def each : Nil
|
||||
iterator.each do |example|
|
||||
yield example
|
||||
yield example if @filter.includes?(example)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue