class SuperDiff::RSpec::MatcherTextBuilders::HavePredicate

Public Class Methods

new(predicate_accessible:, private_predicate:, **rest) click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 5
def initialize(predicate_accessible:, private_predicate:, **rest)
  super(**rest)
  @predicate_accessible = predicate_accessible
  @private_predicate = private_predicate
end

Protected Instance Methods

actual_color() click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 23
def actual_color
  :yellow
end
add_actual_value() click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 27
def add_actual_value
  template.add_text_in_color(actual_color) do
    description_of(actual)
  end
end
add_expected_value_to_description(template) click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 41
def add_expected_value_to_description(template)
  template.add_text " "
  template.add_text_in_color(
    expected_color,
    "`#{expected_for_description}`",
  )
end
add_expected_value_to_failure_message(template) click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 33
def add_expected_value_to_failure_message(template)
  template.add_text " "
  template.add_text_in_color(
    expected_color,
    expected_for_failure_message,
  )
end
expected_action_for_failure_message() click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 13
def expected_action_for_failure_message
  if predicate_accessible?
    "return a truthy result for"
  elsif private_predicate?
    "have a public method"
  else
    "respond to"
  end
end

Private Instance Methods

predicate_accessible?() click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 55
def predicate_accessible?
  @predicate_accessible
end
private_predicate?() click to toggle source
# File lib/super_diff/rspec/matcher_text_builders/have_predicate.rb, line 51
def private_predicate?
  @private_predicate
end