Class: RSpec::Matchers::BuiltIn::Be

Inherits:
BaseMatcher show all
Defined in:
lib/rspec/matchers/built_in/be.rb

Direct Known Subclasses

BeComparedTo, BePredicate

Instance Attribute Summary

Attributes inherited from BaseMatcher

#actual, #expected, #rescued_exception

Instance Method Summary collapse

Methods inherited from BaseMatcher

#==, #description, #diffable?, #match_unless_raises, #matches?

Methods included from Pretty

#_pretty_print, #name, #name_to_sentence, #split_words, #to_sentence, #underscore

Constructor Details

#initialize(*args, &block) ⇒ Be

Returns a new instance of Be.



49
50
51
# File 'lib/rspec/matchers/built_in/be.rb', line 49

def initialize(*args, &block)
  @args = args
end

Instance Method Details

#failure_message_for_shouldObject



57
58
59
# File 'lib/rspec/matchers/built_in/be.rb', line 57

def failure_message_for_should
  "expected #{@actual.inspect} to evaluate to true"
end

#failure_message_for_should_notObject



61
62
63
# File 'lib/rspec/matchers/built_in/be.rb', line 61

def failure_message_for_should_not
  "expected #{@actual.inspect} to evaluate to false"
end

#match(_, actual) ⇒ Object



53
54
55
# File 'lib/rspec/matchers/built_in/be.rb', line 53

def match(_, actual)
  !!actual
end