class RSpec::Matchers::BuiltIn::Include
Public Class Methods
new(*)
click to toggle source
Calls superclass method
# File lib/super_diff/rspec/monkey_patches.rb, line 603 def initialize(*) super @actual = nil end
Public Instance Methods
build_failure_message(negated:)
click to toggle source
Override to capitalize message and add period at end
Calls superclass method
# File lib/super_diff/rspec/monkey_patches.rb, line 621 def build_failure_message(negated:) message = super if actual.respond_to?(:include?) message elsif message.end_with?(".") message.sub("\.$", ", ") + "but it does not respond to `include?`." else message + "\n\nBut it does not respond to `include?`." end end
expected_for_description()
click to toggle source
Override to use readable_list_of
# File lib/super_diff/rspec/monkey_patches.rb, line 634 def expected_for_description readable_list_of(expecteds).lstrip end
expected_for_diff()
click to toggle source
Override this method so that the differ knows that this is a partial array or hash
# File lib/super_diff/rspec/monkey_patches.rb, line 610 def expected_for_diff if expecteds.all? { |item| item.is_a?(Hash) } matchers.a_collection_including(expecteds.first) else matchers.a_collection_including(*expecteds) end end
expected_for_failure_message()
click to toggle source
Override to use readable_list_of
# File lib/super_diff/rspec/monkey_patches.rb, line 639 def expected_for_failure_message # TODO: Switch to using @divergent_items and handle this in the text # builder if defined?(@divergent_items) readable_list_of(@divergent_items).lstrip else "" end end
readable_list_of(items)
click to toggle source
Update to use (…) as delimiter instead of {…}
Calls superclass method
# File lib/super_diff/rspec/monkey_patches.rb, line 650 def readable_list_of(items) if items && items.all? { |item| item.is_a?(Hash) } description_of(items.inject(:merge)). sub(/^\{ /, '('). sub(/ \}$/, ')') else super end end