mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add methods matching RSpec for configuring include and exclude tags
This commit is contained in:
parent
c209fe7259
commit
1e82608500
1 changed files with 13 additions and 0 deletions
|
@ -3,6 +3,7 @@ require "../node_filter"
|
||||||
require "../formatting"
|
require "../formatting"
|
||||||
require "../null_node_filter"
|
require "../null_node_filter"
|
||||||
require "../run_flags"
|
require "../run_flags"
|
||||||
|
require "../tag_node_filter"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
class Config
|
class Config
|
||||||
|
@ -264,11 +265,23 @@ module Spectator
|
||||||
@filters << filter
|
@filters << filter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Specifies one or more tags to constrain running examples to.
|
||||||
|
def filter_run_including(*tags : Symbol, **values)
|
||||||
|
tags.each { |tag| @filters << TagNodeFilter.new(tag) }
|
||||||
|
values.each { |tag, value| @filters << TagNodeFilter.new(tag, value.to_s) }
|
||||||
|
end
|
||||||
|
|
||||||
# Adds a filter to prevent examples from running.
|
# Adds a filter to prevent examples from running.
|
||||||
def add_node_reject(filter : NodeFilter)
|
def add_node_reject(filter : NodeFilter)
|
||||||
@rejects << filter
|
@rejects << filter
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Specifies one or more tags to exclude from running examples.
|
||||||
|
def filter_run_excluding(*tags : Symbol, **values)
|
||||||
|
tags.each { |tag| @rejects << TagNodeFilter.new(tag) }
|
||||||
|
values.each { |tag, value| @rejects << TagNodeFilter.new(tag, value.to_s) }
|
||||||
|
end
|
||||||
|
|
||||||
# Retrieves a filter that determines which examples can run.
|
# Retrieves a filter that determines which examples can run.
|
||||||
# If no filters were added with `#add_node_filter`,
|
# If no filters were added with `#add_node_filter`,
|
||||||
# then the returned filter will allow all examples to be run.
|
# then the returned filter will allow all examples to be run.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue