Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Commit

Permalink
Remove lambda default parameter to maintain ruby compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Nestor committed May 31, 2019
1 parent bee5647 commit 7e54f1f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/rspec/matchers/aliased_matcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def method_missing(*)
#
# @api private
def description
@description_block.call(super)
@description_block.call(super, false)
end

# Provides the failure_message of the aliased matcher. Aliased matchers
Expand All @@ -44,7 +44,7 @@ def description
#
# @api private
def failure_message
@description_block.call(super, replace_after_start: true)
@description_block.call(super, true)
end

# Provides the failure_message_when_negated of the aliased matcher. Aliased matchers
Expand All @@ -54,7 +54,7 @@ def failure_message
#
# @api private
def failure_message_when_negated
@description_block.call(super, replace_after_start: true)
@description_block.call(super, true)
end
end

Expand Down Expand Up @@ -105,7 +105,7 @@ def failure_message_when_negated
def optimal_failure_message(same, inverted)
if DefaultFailureMessages.has_default_failure_messages?(@base_matcher)
base_message = @base_matcher.__send__(same)
overriden = @description_block.call(base_message, replace_after_start: true)
overriden = @description_block.call(base_message, true)
return overriden if overriden != base_message
end

Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/matchers/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def define(name, &declarations)
# @param old_name [Symbol] the name of the old (aliased) matcher
def default_desc_override(new_name, old_name)
old_name_split = EnglishPhrasing.split_words(old_name)
lambda do |old_desc, replace_after_start: false|
lambda do |old_desc, replace_after_start|
if old_desc.start_with?(old_name_split) || replace_after_start
old_desc.sub(old_name_split, EnglishPhrasing.split_words(new_name))
else
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/matchers/aliases_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ module RSpec

specify do
expect {
expect({}).to match(a_hash_including({a: 'include'}))
expect({}).to match(a_hash_including({:a => 'include'}))
}.to fail_including(
'expected {} to match (a hash including {:a => "include"}'
)
Expand Down

0 comments on commit 7e54f1f

Please sign in to comment.