From db9fa63bcdc25ab82fccef52b204ab1f8cfcea38 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Thu, 3 Sep 2020 10:38:32 +0100 Subject: [PATCH] Relax aggregate failures expectations on messages The exact message isn't important and makes this brittle. --- spec/rspec/core/aggregate_failures_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spec/rspec/core/aggregate_failures_spec.rb b/spec/rspec/core/aggregate_failures_spec.rb index df37c15401..5f71ac1239 100644 --- a/spec/rspec/core/aggregate_failures_spec.rb +++ b/spec/rspec/core/aggregate_failures_spec.rb @@ -15,7 +15,7 @@ expect(ex.execution_result.__send__(exception_attribute)).to have_attributes( :all_exceptions => [ - an_object_having_attributes(:message => 'expected `1.even?` to return true, got false'), + an_object_having_attributes(:message => /expected.*even\?/), an_object_having_attributes(:message => 'after'), an_object_having_attributes(:message => 'around') ] @@ -49,8 +49,8 @@ ) expect(exception.all_exceptions.first.all_exceptions).to match [ - an_object_having_attributes(:message => 'expected `1.even?` to return true, got false'), - an_object_having_attributes(:message => 'expected `2.odd?` to return true, got false') + an_object_having_attributes(:message => /expected.*even\?/), + an_object_having_attributes(:message => /expected.*odd\?/) ] end end @@ -71,8 +71,8 @@ expect(ex.execution_result.status).to eq(:pending) if example_meta.key?(:pending) expect(ex.execution_result.__send__(exception_attribute)).to have_attributes( :all_exceptions => [ - an_object_having_attributes(:message => 'expected `1.even?` to return true, got false'), - an_object_having_attributes(:message => 'expected `2.odd?` to return true, got false') + an_object_having_attributes(:message => /expected.*even\?/), + an_object_having_attributes(:message => /expected.*odd\?/) ] ) end @@ -90,7 +90,7 @@ expect(ex.execution_result.__send__(exception_attribute)).to have_attributes( :all_exceptions => [ - an_object_having_attributes(:message => 'expected `1.even?` to return true, got false'), + an_object_having_attributes(:message => /expected.*even\?/), an_object_having_attributes(:class => NameError, :message => /boom/) ] ) @@ -111,8 +111,8 @@ expect(ex.execution_result.__send__(exception_attribute)).to have_attributes( :all_exceptions => [ - an_object_having_attributes(:message => 'expected `1.even?` to return true, got false'), - an_object_having_attributes(:message => 'expected `2.odd?` to return true, got false'), + an_object_having_attributes(:message => /expected.*even\?/), + an_object_having_attributes(:message => /expected.*odd\?/), an_object_having_attributes(:class => NameError, :message => /boom/) ] )