Class: RSpec::Matchers::Be

Inherits:
Object
  • Object
show all
Includes:
Pretty
Defined in:
lib/rspec/matchers/be.rb

Direct Known Subclasses

BeComparedTo, BePredicate

Instance Method Summary collapse

Methods included from Pretty

#_pretty_print, #split_words, #to_sentence

Constructor Details

#initialize(*args, &block) ⇒ Be

Returns a new instance of Be.



36
37
38
# File 'lib/rspec/matchers/be.rb', line 36

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

Instance Method Details

#descriptionObject



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

def description
  "be"
end

#failure_message_for_shouldObject



45
46
47
# File 'lib/rspec/matchers/be.rb', line 45

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

#failure_message_for_should_notObject



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

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
43
# File 'lib/rspec/matchers/be.rb', line 40

def matches?(actual)
  @actual = actual
  !!@actual
end