File: ruby25_expectations.patch

package info (click to toggle)
ruby-rspec 3.8.0c0e1m0s0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,640 kB
  • sloc: ruby: 65,844; sh: 807; makefile: 99
file content (30 lines) | stat: -rw-r--r-- 1,356 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Description: disable `report_on_exception` causing test failures on ruby2.5
Author: Myron Marston <myron.marston@gmail.com>
Bug: https://github.com/rspec/rspec-expectations/issues/1031
Origin: https://github.com/rspec/rspec-expectations/commit/afcd9a294b65ebfff78976bebcf62d72385b5b4d.patch
Applied-Upstream: yes
Last-Update: 2018-02-05

--- a/rspec-expectations/spec/rspec/expectations/failure_aggregator_spec.rb
+++ b/rspec-expectations/spec/rspec/expectations/failure_aggregator_spec.rb
@@ -216,6 +216,19 @@ def expect_error_included_in_aggregated_failure(error)
     end
 
     context "when an expectation failure happens in another thread" do
+      # On Ruby 2.5+, the new `report_on_exception` causes the errors in the threads
+      # to print warnings, which our rspec-support test harness converts into a test
+      # failure since we want to enforce warnings-free code. To prevent the warning,
+      # we need to disable the setting here.
+      if Thread.respond_to?(:report_on_exception)
+        around do |example|
+          orig = Thread.report_on_exception
+          Thread.report_on_exception = false
+          example.run
+          Thread.report_on_exception = orig
+        end
+      end
+
       it "includes the failure in the failures array if there are other failures" do
         expect {
           aggregate_failures do