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

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

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

- (Object) description



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

def description
  "be"
end

- (Object) failure_message_for_should



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

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

- (Object) failure_message_for_should_not



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

- (Boolean) matches?(actual)

Returns:

  • (Boolean)


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

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