Class: Spec::Matchers::Include

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/matchers/include.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(*expecteds) ⇒ Include

Returns a new instance of Include.



6
7
8
# File 'lib/spec/matchers/include.rb', line 6

def initialize(*expecteds)
  @expecteds = expecteds
end

Instance Method Details

#descriptionObject



26
27
28
# File 'lib/spec/matchers/include.rb', line 26

def description
  "include #{_pretty_print(@expecteds)}"
end

#failure_messageObject



18
19
20
# File 'lib/spec/matchers/include.rb', line 18

def failure_message
  _message
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/spec/matchers/include.rb', line 10

def matches?(actual)
  @actual = actual
  @expecteds.each do |expected|
    return false unless actual.include?(expected)
  end
  true
end

#negative_failure_messageObject



22
23
24
# File 'lib/spec/matchers/include.rb', line 22

def negative_failure_message
  _message("not ")
end