From a65189c43e5bd67e05ede16d37ce79c059359ab2 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 2 May 2024 16:55:19 +1000 Subject: [PATCH] Improve failure messages of chained expectations --- spec/base_spec_helper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/base_spec_helper.rb b/spec/base_spec_helper.rb index 42ce4e6ad6..aabd97dbdf 100644 --- a/spec/base_spec_helper.rb +++ b/spec/base_spec_helper.rb @@ -94,6 +94,15 @@ RSpec.configure do |config| # Force use of expect (over should) config.expect_with :rspec do |expectations| expectations.syntax = :expect + + # This option will default to `true` in RSpec 4. It makes the `description` + # and `failure_message` of custom matchers include text for helper methods + # defined using `chain`, e.g.: + # be_bigger_than(2).and_smaller_than(4).description + # # => "be bigger than 2 and smaller than 4" + # ...rather than: + # # => "be bigger than 2" + expectations.include_chain_clauses_in_custom_matcher_descriptions = true end # Reset locale for all specs.