Class: MotionSpec::Matcher::Include

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-spec/matcher/include.rb

Instance Method Summary collapse

Constructor Details

#initialize(*values) ⇒ Include

Returns a new instance of Include.



5
6
7
# File 'lib/motion-spec/matcher/include.rb', line 5

def initialize(*values)
  @values = *values
end

Instance Method Details

#fail!(subject, negated) ⇒ Object

Raises:



13
14
15
16
17
# File 'lib/motion-spec/matcher/include.rb', line 13

def fail!(subject, negated)
  raise FailedExpectation.new(
    FailMessageRenderer.message_for_include(negated, subject, @values)
  )
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/motion-spec/matcher/include.rb', line 9

def matches?(subject)
  @values.all? { |v| subject.include?(v) }
end