Module: PrismChecker::ItemChecker::ItemCheck::String

Instance Method Summary collapse

Instance Method Details

#check(_element, value, expectation) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/prism_checker/item_checker/item_check/string.rb', line 7

def check(_element, value, expectation)
  if PrismChecker.string_comparison == :inclusion
    value.to_s.include?(expectation)
  else
    value == expectation
  end
end

#error_message(_element, value, expectation) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/prism_checker/item_checker/item_check/string.rb', line 15

def error_message(_element, value, expectation)
  if PrismChecker.string_comparison == :inclusion
    "Expected '#{value}' to include '#{expectation}'"
  else
    "Expected '#{value}' to be equal '#{expectation}'"
  end
end