Class: Pancake::Test::Matchers::InheritFrom

Inherits:
Object
  • Object
show all
Defined in:
lib/pancake/test/matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ InheritFrom

Returns a new instance of InheritFrom.



39
40
41
# File 'lib/pancake/test/matchers.rb', line 39

def initialize(expected)
  @expected = expected
end

Instance Method Details

#failure_messageObject



48
49
50
# File 'lib/pancake/test/matchers.rb', line 48

def failure_message
  "expected #{@target} to inherit from #{@expected} but did not"
end

#matches?(target) ⇒ Boolean

Returns:

  • (Boolean)


43
44
45
46
# File 'lib/pancake/test/matchers.rb', line 43

def matches?(target)
  @target = target
  @target.ancestors.include?(@expected)
end