Class: RSpec::Matchers::BuiltIn::Include

Inherits:
BaseMatcher show all
Defined in:
lib/rspec/matchers/built_in/include.rb

Instance Attribute Summary

Attributes inherited from BaseMatcher

#actual, #expected, #rescued_exception

Instance Method Summary collapse

Methods inherited from BaseMatcher

#==, #failure_message_for_should, #failure_message_for_should_not, #match_unless_raises

Methods included from Pretty

#_pretty_print, #expected_to_sentence, #name, #name_to_sentence, #split_words, #to_sentence, #underscore

Constructor Details

#initialize(*expected) ⇒ Include

Returns a new instance of Include.



5
6
7
# File 'lib/rspec/matchers/built_in/include.rb', line 5

def initialize(*expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



19
20
21
# File 'lib/rspec/matchers/built_in/include.rb', line 19

def description
  "include#{expected_to_sentence}"
end

#diffable?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/rspec/matchers/built_in/include.rb', line 23

def diffable?
  true
end

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/rspec/matchers/built_in/include.rb', line 14

def does_not_match?(actual)
  @actual = actual
  perform_match(:none?, :any?, @actual, @expected)
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/rspec/matchers/built_in/include.rb', line 9

def matches?(actual)
  @actual = actual
  perform_match(:all?, :all?, @actual, @expected)
end