diff options
author | Andre Arko <andre@arko.net> | 2015-07-30 16:56:08 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-07-30 16:56:08 -0700 |
commit | 95270c88f56f49fd6887eef6a63c07a3af3ad632 (patch) | |
tree | 19e26e86384f5fb6137408edda593181140f6f07 | |
parent | 7c7d6174fc6b5e73c0f5ba30641a9132cfa54af6 (diff) | |
download | bundler-reduce-ci-failures.tar.gz |
remove the code we don't needreduce-ci-failures
-rw-r--r-- | spec/support/sometimes.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/spec/support/sometimes.rb b/spec/support/sometimes.rb index 1655abecc8..99fc9e9444 100644 --- a/spec/support/sometimes.rb +++ b/spec/support/sometimes.rb @@ -2,12 +2,14 @@ module Sometimes def run_with_retries(example_to_run, retries) example = RSpec.current_example example.metadata[:retries] ||= retries + retries.times do |t| example.metadata[:retried] = t + 1 example.instance_variable_set(:@exception, nil) example_to_run.run break unless example.exception end + if e = example.exception new_exception = e.exception(e.message + "[Retried #{retries} times]") new_exception.set_backtrace e.backtrace @@ -27,12 +29,12 @@ RSpec.configure do |config| end config.after(:suite) do - formatter = - message = lambda {|color, text| + message = Proc.new do |color, text| colored = RSpec::Core::Formatters::ConsoleCodes.wrap(text, color) notification = RSpec::Core::Notifications::MessageNotification.new(colored) RSpec.configuration.formatters.first.message(notification) - } + end + retried_examples = RSpec.world.example_groups.map do |g| g.descendants.map do |d| d.filtered_examples.select do |e| @@ -40,13 +42,13 @@ RSpec.configure do |config| end end end.flatten + message.call(retried_examples.empty? ? :green : :yellow, "\n\nRetried examples: #{retried_examples.count}") - unless retried_examples.empty? - retried_examples.each do |e| - message.call(:cyan, " #{e.full_description}") - path = RSpec::Core::Metadata.relative_path(e.location) - message.call(:cyan, " [#{e.metadata[:retried]}/#{e.metadata[:retries]}] " + path) - end + + retried_examples.each do |e| + message.call(:cyan, " #{e.full_description}") + path = RSpec::Core::Metadata.relative_path(e.location) + message.call(:cyan, " [#{e.metadata[:retried]}/#{e.metadata[:retries]}] " + path) end end end |