@@ -19,30 +19,10 @@ def scenario_groups(group_size, options)
19
19
all_runnable_scenarios = distribution_data . map do |feature |
20
20
next if feature [ 'elements' ] . nil?
21
21
feature [ 'elements' ] . map do |scenario |
22
- if scenario [ 'keyword' ] == 'Scenario'
23
- {
24
- line : "#{ feature [ 'uri' ] } :#{ scenario [ 'line' ] } " ,
25
- weight : 1
26
- }
27
- elsif scenario [ 'keyword' ] == 'Scenario Outline'
28
- if scenario [ 'examples' ]
29
- scenario [ 'examples' ] . map do |example |
30
- examples_count = example [ 'rows' ] . count - 1 # Do not count the first row with column names
31
- next unless examples_count > 0
32
- {
33
- line : "#{ feature [ 'uri' ] } :#{ example [ 'line' ] } " ,
34
- weight : examples_count
35
- }
36
- end
37
- else # Cucumber 1.3 with -x/--expand or Cucumber > 2.0
38
- {
39
- line : "#{ feature [ 'uri' ] } :#{ scenario [ 'line' ] } " ,
40
- weight : 1
41
- }
42
- end
43
- end
22
+ "#{ feature [ 'uri' ] } :#{ scenario [ 'line' ] } " if [ 'Scenario' , 'Scenario Outline' ] . include? ( scenario [ 'keyword' ] )
44
23
end
45
24
end . flatten . compact
25
+
46
26
group_creator ( group_size , all_runnable_scenarios )
47
27
end
48
28
@@ -89,25 +69,24 @@ def _expand_profiles(options, config)
89
69
expand_next = false
90
70
options . split . map do |option |
91
71
case
92
- when %w( -p --profile ) . include? ( option )
93
- expand_next = true
94
- next
95
- when expand_next
96
- expand_next = false
97
- _expand_profiles ( config [ option ] , config )
98
- else
99
- option
72
+ when %w( -p --profile ) . include? ( option )
73
+ expand_next = true
74
+ next
75
+ when expand_next
76
+ expand_next = false
77
+ _expand_profiles ( config [ option ] , config )
78
+ else
79
+ option
100
80
end
101
81
end . compact . join ( ' ' )
102
82
end
103
83
104
84
def group_creator ( groups_count , tasks )
105
85
groups = Array . new ( groups_count ) { [ ] }
106
86
107
- sorted_tasks = tasks . sort { |t1 , t2 | t2 [ :weight ] <=> t1 [ :weight ] }
108
- sorted_tasks . each do |task |
87
+ tasks . each do |task |
109
88
group = groups . min_by ( &:size )
110
- group . push ( task [ :line ] , * Array . new ( task [ :weight ] - 1 ) )
89
+ group . push ( task )
111
90
end
112
91
groups . reject ( &:empty? ) . map ( &:compact )
113
92
end
0 commit comments