The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::BDD::Cucumber::Model::TagSpec - Encapsulates tag selectors

VERSION

version 0.18

DESCRIPTION

Try and deal with the crazy-sauce tagging mechanism in a sane way.

OVERVIEW

Cucumber tags are all sortsa crazy. This appears to be a direct result of trying to shoe-horn the syntax in to something you can use on the command line. Because 'Cucumber' is the name of a gem, application, language, methodology etc etc etc look of disapproval.

Here is some further reading on how it's meant to work: https://github.com/cucumber/cucumber/wiki/Tags. This is obviously a little insane.

Here's how they work here, on a code level: You pass in a list of lists that look like Lisp expressions, with a function: and, or, or not. You can nest these to infinite complexity, but the parser is pretty inefficient, so don't do that. The not function accepts only one argument.

eg:

@important AND @billing: [and = 'important', 'billing']>

(@billing OR @WIP) AND @important: [ and = [ or => 'billing', 'wip' ], 'important' ]>

Skipping both @todo and @wip tags: [ and = [ not => 'todo' ], [ not => 'wip' ] ]>

ATTRIBUTES

tags

An arrayref representing a structure like the above.

 TagSet->new({
        tags => [ and => 'green', 'blue', [ or => 'red', 'yellow' ], [ not => 'white' ] ]
 })

METHODS

filter

Filter a list of Scenarios by the value of tags

 my @matched = $tagset->filter( @scenarios );

If tags is empty, no filtering is done.