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, #to_word, #underscore

Constructor Details

- (Be) initialize(*args, &block)

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

- (Object) failure_message_for_should



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

- (Object) failure_message_for_should_not



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

- (Object) match(_, actual)



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

def match(_, actual)
  !!actual
end