Upgrade to Cucumber 3.0 (#6395)

Merge pull request 6395
This commit is contained in:
Frank Taillandier 2017-09-29 09:39:19 +02:00 committed by jekyllbot
parent 5df6e3f865
commit 7333baf06d
3 changed files with 22 additions and 13 deletions

View File

@ -23,7 +23,7 @@ end
group :test do group :test do
gem "codeclimate-test-reporter", "~> 1.0.5" gem "codeclimate-test-reporter", "~> 1.0.5"
gem "cucumber", "~> 2.1" gem "cucumber", "~> 3.0"
gem "jekyll_test_plugin" gem "jekyll_test_plugin"
gem "jekyll_test_plugin_malicious" gem "jekyll_test_plugin_malicious"
# nokogiri v1.8 does not work with ruby 2.1 and below # nokogiri v1.8 does not work with ruby 2.1 and below

View File

@ -59,7 +59,7 @@ module Jekyll
# #
def feature_element_timing_key(feature_element) def feature_element_timing_key(feature_element)
"\"#{feature_element.name.to_s.sub("Scenario: ", "")}\" (#{feature_element.location})" "\"#{feature_element.name}\" (#{feature_element.location})"
end end
# #
@ -173,16 +173,8 @@ module Jekyll
# #
private def print_feature_element_name(feature_element)
def print_feature_element_name(keyword, name, source_line, _indent) @io.print "\n#{feature_element.location} Scenario: #{feature_element.name} "
@io.puts
names = name.empty? ? [name] : name.each_line.to_a
line = " #{keyword}: #{names[0]}"
@io.print(source_line) if @options[:source]
@io.print(line)
@io.print " "
@io.flush @io.flush
end end
@ -214,3 +206,20 @@ module Jekyll
end end
end end
end end
AfterConfiguration do |config|
f = Jekyll::Cucumber::Formatter.new(nil, $stdout, {})
config.on_event :test_case_started do |event|
f.print_feature_element_name(event.test_case)
f.before_feature_element(event.test_case)
end
config.on_event :test_case_finished do |event|
f.after_feature_element(event.test_case)
end
config.on_event :test_run_finished do
f.print_worst_offenders
end
end

View File

@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
time ruby -S bundle exec cucumber \ time ruby -S bundle exec cucumber \
-f Jekyll::Cucumber::Formatter "$@" --format progress "$@"