Skip to content

Commit

Permalink
Flip include_chain_clauses_in_custom_matcher_descriptions default
Browse files Browse the repository at this point in the history
From 3.1.0 changelog
(https://github.com/rspec/rspec-core/blame/main/Changelog.md#L773):

> the new rspec-expectations
> `include_chain_clauses_in_custom_matcher_descriptions` config option
> (which will be on by default in RSpec 4)
  • Loading branch information
pirj committed Dec 26, 2020
1 parent 3a55a2d commit db4806c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Breaking Changes:
* Extract `should*` (both monkey-patching and non-monkey-patching). (Phil Pirozhkov, #1245)
* Remove deprecated `LegacyMacherAdapter`. (Phil Pirozhkov, #1253)
* Remove support for legacy RSpec matchers (pre 3). (Phil Pirozhkov, #1253)
* Change the default for `include_chain_clauses_in_custom_matcher_descriptions`
configuration option to `true`. (Phil Pirozhkov, #1253)

Enhancements:

Expand Down
6 changes: 3 additions & 3 deletions lib/rspec/expectations/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class Configuration
}

def initialize
@include_chain_clauses_in_custom_matcher_descriptions = true
@on_potential_false_positives = :warn
@strict_predicate_matchers = false
end
Expand Down Expand Up @@ -86,10 +87,9 @@ def backtrace_formatter
attr_writer :include_chain_clauses_in_custom_matcher_descriptions

# Indicates whether or not custom matcher descriptions and failure messages
# should include clauses from methods defined using `chain`. It is
# false by default for backwards compatibility.
# should include clauses from methods defined using `chain`.
def include_chain_clauses_in_custom_matcher_descriptions?
@include_chain_clauses_in_custom_matcher_descriptions ||= false
@include_chain_clauses_in_custom_matcher_descriptions
end

# @api private
Expand Down
16 changes: 8 additions & 8 deletions spec/rspec/expectations/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ class << rspec_dup; undef configuration; end
end

describe "#include_chain_clauses_in_custom_matcher_descriptions?" do
it "is false by default" do
expect(config.include_chain_clauses_in_custom_matcher_descriptions?).to be false
end

it "can be set to true" do
config.include_chain_clauses_in_custom_matcher_descriptions = true
it "is true by default" do
expect(config.include_chain_clauses_in_custom_matcher_descriptions?).to be true
end

it "can be set back to false" do
config.include_chain_clauses_in_custom_matcher_descriptions = true
it "can be set to false" do
config.include_chain_clauses_in_custom_matcher_descriptions = false
expect(config.include_chain_clauses_in_custom_matcher_descriptions?).to be false
end

it "can be set back to true" do
config.include_chain_clauses_in_custom_matcher_descriptions = false
config.include_chain_clauses_in_custom_matcher_descriptions = true
expect(config.include_chain_clauses_in_custom_matcher_descriptions?).to be true
end
end

describe "#max_formatted_output_length=" do
Expand Down

0 comments on commit db4806c

Please sign in to comment.