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

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

Direct Known Subclasses

BeComparedTo

Constant Summary

Constant Summary

Constants inherited from BaseMatcher

RSpec::Matchers::BuiltIn::BaseMatcher::UNDEFINED

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, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #to_word, #underscore

Constructor Details

- (Be) initialize(*args)

A new instance of Be



75
76
77
# File 'lib/rspec/matchers/built_in/be.rb', line 75

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

Instance Method Details

- (Object) failure_message_for_should



83
84
85
# File 'lib/rspec/matchers/built_in/be.rb', line 83

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

- (Object) failure_message_for_should_not



87
88
89
# File 'lib/rspec/matchers/built_in/be.rb', line 87

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

- (Object) match(_, actual)



79
80
81
# File 'lib/rspec/matchers/built_in/be.rb', line 79

def match(_, actual)
  !!actual
end