Skip to content

Commit

Permalink
Drop cucumber 1.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Jan 20, 2016
1 parent 0c7212d commit fbc8ae1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
parallel_cucumber (0.1.21)
cucumber
parallel_cucumber (0.1.22)
cucumber (~> 2)
parallel (~> 1.6)

GEM
Expand Down
45 changes: 12 additions & 33 deletions lib/parallel_cucumber/grouper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,10 @@ def scenario_groups(group_size, options)
all_runnable_scenarios = distribution_data.map do |feature|
next if feature['elements'].nil?
feature['elements'].map do |scenario|
if scenario['keyword'] == 'Scenario'
{
line: "#{feature['uri']}:#{scenario['line']}",
weight: 1
}
elsif scenario['keyword'] == 'Scenario Outline'
if scenario['examples']
scenario['examples'].map do |example|
examples_count = example['rows'].count - 1 # Do not count the first row with column names
next unless examples_count > 0
{
line: "#{feature['uri']}:#{example['line']}",
weight: examples_count
}
end
else # Cucumber 1.3 with -x/--expand or Cucumber > 2.0
{
line: "#{feature['uri']}:#{scenario['line']}",
weight: 1
}
end
end
"#{feature['uri']}:#{scenario['line']}" if ['Scenario', 'Scenario Outline'].include?(scenario['keyword'])
end
end.flatten.compact

group_creator(group_size, all_runnable_scenarios)
end

Expand Down Expand Up @@ -89,25 +69,24 @@ def _expand_profiles(options, config)
expand_next = false
options.split.map do |option|
case
when %w(-p --profile).include?(option)
expand_next = true
next
when expand_next
expand_next = false
_expand_profiles(config[option], config)
else
option
when %w(-p --profile).include?(option)
expand_next = true
next
when expand_next
expand_next = false
_expand_profiles(config[option], config)
else
option
end
end.compact.join(' ')
end

def group_creator(groups_count, tasks)
groups = Array.new(groups_count) { [] }

sorted_tasks = tasks.sort { |t1, t2| t2[:weight] <=> t1[:weight] }
sorted_tasks.each do |task|
tasks.each do |task|
group = groups.min_by(&:size)
group.push(task[:line], *Array.new(task[:weight] - 1))
group.push(task)
end
groups.reject(&:empty?).map(&:compact)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/parallel_cucumber/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ParallelCucumber
VERSION = '0.1.21'.freeze
VERSION = '0.1.22'.freeze
end # ParallelCucumber
2 changes: 1 addition & 1 deletion parallel_cucumber.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new name, ParallelCucumber::VERSION do |spec|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.require_paths = 'lib'

spec.add_runtime_dependency 'cucumber'
spec.add_runtime_dependency 'cucumber', '~> 2'
spec.add_runtime_dependency 'parallel', '~> 1.6'
spec.add_development_dependency 'rubocop', '~> 0.36'
end

0 comments on commit fbc8ae1

Please sign in to comment.