Implement aggregate_failures

This commit is contained in:
Michael Miller 2021-07-31 11:56:53 -06:00
parent 9a97596b84
commit 4c125d98d4
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD
5 changed files with 100 additions and 2 deletions

View file

@ -0,0 +1,32 @@
require "../spec_helper"
Spectator.describe Spectator do
describe "aggregate_failures" do
it "captures multiple failed expectations" do
expect do
aggregate_failures do
expect(true).to be_false
expect(false).to be_true
end
end.to raise_error(Spectator::MultipleExpectationsFailed, /2 failures/)
end
it "raises normally for one failed expectation" do
expect do
aggregate_failures do
expect(true).to be_false
expect(true).to be_true
end
end.to raise_error(Spectator::ExpectationFailed)
end
it "doesn't raise when there are no failed expectations" do
expect do
aggregate_failures do
expect(false).to be_false
expect(true).to be_true
end
end.to_not raise_error(Spectator::ExpectationFailed)
end
end
end