Sha256: 8ca5cd1949abf238bda83100b661cbf4dfabce1ee3027b7ef8d2210ec60ed2b4

Contents?: true

Size: 474 Bytes

Versions: 198

Compression:

Stored size: 474 Bytes

Contents

class BeAncestorOfMatcher
  def initialize(expected)
    @expected = expected
  end

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

  def failure_message
    ["Expected #{@actual}", "to be an ancestor of #{@expected}"]
  end

  def negative_failure_message
    ["Expected #{@actual}", "not to be an ancestor of #{@expected}"]
  end
end

class Object
  def be_ancestor_of(expected)
    BeAncestorOfMatcher.new(expected)
  end
end

Version data entries

198 entries across 174 versions & 4 rubygems

Version Path
rhodes-7.6.0 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-7.5.1 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-7.4.1 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-7.1.17 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-6.2.0 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-6.0.11 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.18 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.17 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.15 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.0.22 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.2 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.0.7 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.0.3 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
rhodes-5.5.0 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
tauplatform-1.0.3 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
mspec-1.9.1 lib/mspec/matchers/be_ancestor_of.rb
mspec-1.9.0 lib/mspec/matchers/be_ancestor_of.rb
tauplatform-1.0.2 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
tauplatform-1.0.1 lib/extensions/mspec/mspec/matchers/be_ancestor_of.rb
mspec-1.8.0 lib/mspec/matchers/be_ancestor_of.rb