Class: Spec::Matchers::Be

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

Overview

:nodoc:

Direct Known Subclasses

BeComparedTo, BePredicate, BeSameAs

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.



35
36
37
# File 'lib/spec/matchers/be.rb', line 35

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

Instance Method Details

#descriptionObject



52
53
54
# File 'lib/spec/matchers/be.rb', line 52

def description
  "be"
end

#failure_message_for_shouldObject



44
45
46
# File 'lib/spec/matchers/be.rb', line 44

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

#failure_message_for_should_notObject



48
49
50
# File 'lib/spec/matchers/be.rb', line 48

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

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
42
# File 'lib/spec/matchers/be.rb', line 39

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