Class: CukeIterations::ScenarioListGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/cuke_iterations/scenario_list_generator.rb

Class Method Summary collapse

Class Method Details

.for_iteration(scenarios, iteration_info) ⇒ Object



4
5
6
7
8
9
# File 'lib/cuke_iterations/scenario_list_generator.rb', line 4

def for_iteration(scenarios, iteration_info)
  scenarios.select do |s|
    next if is_excluded?(s, iteration_info)
    is_included_by_tag?(s, iteration_info) || no_include_tags_specified?(iteration_info)
  end
end

.is_excluded?(scenario, iteration) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cuke_iterations/scenario_list_generator.rb', line 19

def is_excluded?(scenario, iteration)
  (scenario[:tags] & iteration[:exclude_tags]).any?
end

.is_included_by_tag?(scenario, iteration) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/cuke_iterations/scenario_list_generator.rb', line 15

def is_included_by_tag?(scenario, iteration)
  (scenario[:tags] & iteration[:include_tags]).any?
end

.no_include_tags_specified?(iteration) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/cuke_iterations/scenario_list_generator.rb', line 11

def no_include_tags_specified?(iteration)
  iteration[:include_tags] == []
end