Class: CukeForker::Scenarios
- Inherits:
-
Object
- Object
- CukeForker::Scenarios
- Defined in:
- lib/cukeforker/scenarios.rb
Overview
CukeForker::Scenarios.by_args(args)
where ‘args’ is a String of cucumber options
For example: CukeForker::Scenarios.by_args(%W[-p my_profile -t @edition]) will return an array of scenarios and their line numbers that match the tags specified in the cucumber profile ‘my_profile’ AND have the ‘@edition’ tag
Class Method Summary collapse
Class Method Details
.all ⇒ Object
22 23 24 25 |
# File 'lib/cukeforker/scenarios.rb', line 22 def self.all any_tag = [] tagged any_tag end |
.by_args(args) ⇒ Object
17 18 19 20 |
# File 'lib/cukeforker/scenarios.rb', line 17 def self.by_args(args) = Cucumber::Cli::Options.new(STDOUT, STDERR, :default_profile => 'default') tagged(.parse!(args)[:tag_expressions]) end |
.feature_files ⇒ Object
39 40 41 |
# File 'lib/cukeforker/scenarios.rb', line 39 def self.feature_files Dir.glob('**/**.feature') end |
.tagged(tags) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cukeforker/scenarios.rb', line 27 def self.tagged() tag_expression = Gherkin::TagExpression.new() scenario_line_logger = CukeForker::Formatters::ScenarioLineLogger.new(tag_expression) loader = Cucumber::Runtime::FeaturesLoader.new(feature_files, [], tag_expression) loader.features.each do |feature| feature.accept(scenario_line_logger) end scenario_line_logger.scenarios end |