diff --git a/lib/buildkite/test_collector.rb b/lib/buildkite/test_collector.rb index 7abd033..55cf666 100644 --- a/lib/buildkite/test_collector.rb +++ b/lib/buildkite/test_collector.rb @@ -12,7 +12,6 @@ module TestCollector require "timeout" require "tmpdir" -require "active_support/core_ext/object/blank" require "active_support/core_ext/hash/indifferent_access" require "active_support/notifications" diff --git a/lib/buildkite/test_collector/rspec_plugin/reporter.rb b/lib/buildkite/test_collector/rspec_plugin/reporter.rb index 5860bcf..609548b 100644 --- a/lib/buildkite/test_collector/rspec_plugin/reporter.rb +++ b/lib/buildkite/test_collector/rspec_plugin/reporter.rb @@ -40,6 +40,10 @@ def dump_summary(_notification) RSpec::Core::MultipleExceptionError ] + def blank?(string) + string.nil? || string.strip.empty? + end + def failure_info(notification) failure_expanded = [] @@ -73,9 +77,9 @@ def failure_info(notification) def format_message_lines(message_lines) message_lines.map! { |l| strip_diff_colors(l) } # the first line is sometimes blank, depending on the error reported - message_lines.shift if message_lines.first.blank? + message_lines.shift if blank?(message_lines.first) # the last line is sometimes blank, depending on the error reported - message_lines.pop if message_lines.last.blank? + message_lines.pop if blank?(message_lines.last) message_lines end diff --git a/lib/buildkite/test_collector/rspec_plugin/trace.rb b/lib/buildkite/test_collector/rspec_plugin/trace.rb index 3a9b755..d45decd 100644 --- a/lib/buildkite/test_collector/rspec_plugin/trace.rb +++ b/lib/buildkite/test_collector/rspec_plugin/trace.rb @@ -60,7 +60,7 @@ def file_name end def shared_example? - example.metadata[:shared_group_inclusion_backtrace].any? + !example.metadata[:shared_group_inclusion_backtrace].empty? end def shared_example_call_location diff --git a/lib/buildkite/test_collector/test_links_plugin/formatter.rb b/lib/buildkite/test_collector/test_links_plugin/formatter.rb index a3a4646..c6e9349 100644 --- a/lib/buildkite/test_collector/test_links_plugin/formatter.rb +++ b/lib/buildkite/test_collector/test_links_plugin/formatter.rb @@ -10,7 +10,7 @@ def initialize(output) def dump_failures(notification) # Do not display summary if no failed examples - return unless notification.failed_examples.present? + return if notification.failed_examples.empty? # Check if a Test Analytics token is set return unless Buildkite::TestCollector.api_token