Class: JCukeForker::Scenarios

Inherits:
Object
  • Object
show all
Includes:
Cucumber::Core
Defined in:
lib/jcukeforker/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

.allObject



24
25
26
27
# File 'lib/jcukeforker/scenarios.rb', line 24

def self.all
  any_tag = []
  tagged any_tag
end

.by_args(args) ⇒ Object



19
20
21
22
# File 'lib/jcukeforker/scenarios.rb', line 19

def self.by_args(args)
  options = Cucumber::Cli::Options.new(STDOUT, STDERR, :default_profile => 'default')
  tagged(options.parse!(args)[:tag_expressions])
end

.feature_filesObject



39
40
41
# File 'lib/jcukeforker/scenarios.rb', line 39

def self.feature_files
  Dir.glob('**/**.feature')
end

.tagged(tags) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/jcukeforker/scenarios.rb', line 29

def self.tagged(tags)
  scenario_list = ScenarioList.new
  feature_files.each do |feature|
    source = JCukeForker::NormalisedEncodingFile.read(feature)
    file = Cucumber::Core::Gherkin::Document.new(feature, source)
    self.new.execute([file], scenario_list, [Cucumber::Core::Test::TagFilter.new(tags)])
  end
  scenario_list.scenarios
end