Class: RSpec::Matchers::BuiltIn::BePredicate Private

Inherits:
BaseMatcher
  • Object
show all
Defined in:
lib/rspec/matchers/built_in/be.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Provides the implementation of be_<predicate>. Not intended to be instantiated directly.

Constant Summary

Constant Summary

Constants inherited from BaseMatcher

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

Instance Method Summary (collapse)

Methods inherited from BaseMatcher

#diffable?, #match_unless_raises, #supports_block_expectations?

Methods included from Composable

#===, #and, #description_of, enumerable?, #or, surface_descriptions_in, #values_match?

Methods included from Pretty

#name, split_words, #to_sentence, #to_word

Constructor Details

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

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of BePredicate



182
183
184
185
186
# File 'lib/rspec/matchers/built_in/be.rb', line 182

def initialize(*args, &block)
  @expected = parse_expected(args.shift)
  @args = args
  @block = block
end

Instance Method Details

- (String) description

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


214
215
216
# File 'lib/rspec/matchers/built_in/be.rb', line 214

def description
  "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}"
end

- (Boolean) does_not_match?(actual, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


194
195
196
197
198
# File 'lib/rspec/matchers/built_in/be.rb', line 194

def does_not_match?(actual, &block)
  @actual  = actual
  @block ||= block
  predicate_accessible? && !predicate_matches?
end

- (String) failure_message

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


202
203
204
# File 'lib/rspec/matchers/built_in/be.rb', line 202

def failure_message
  failure_message_expecting(true)
end

- (String) failure_message_when_negated

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (String)


208
209
210
# File 'lib/rspec/matchers/built_in/be.rb', line 208

def failure_message_when_negated
  failure_message_expecting(false)
end

- (Boolean) matches?(actual, &block)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


188
189
190
191
192
# File 'lib/rspec/matchers/built_in/be.rb', line 188

def matches?(actual, &block)
  @actual  = actual
  @block ||= block
  predicate_accessible? && predicate_matches?
end