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 31 32 33 34 35 36 37 38 39 40 41 42
|
# frozen_string_literal: true
RSpec.describe 'tests with multiple failures' do
they 'show multiple failures' do
expect do
@initial = nil
hypothesis do
x = any integers
if @initial.nil?
if x >= 1000
@initial = x
else
next
end
end
expect(x).to_not eq(@initial)
raise 'Nope'
end
end.to raise_exception(Hypothesis::MultipleExceptionError) { |e|
expect(e.all_exceptions.length).to eq(2)
}
end
end
RSpec.describe Hypothesis::MultipleExceptionError do
it 'includes the message from each exception' do
exceptions = []
%w[hello world].each do |m|
begin
raise m
rescue Exception => e
exceptions.push(e)
end
end
e = Hypothesis::MultipleExceptionError.new(*exceptions)
expect(e.message).to include('hello')
expect(e.message).to include('world')
end
end
|