Sha256: c6c7ad3d25f33fc6aa5954fe94cea60aafe160ea2b57f2e68e976724677086b0

Contents?: true

Size: 626 Bytes

Versions: 67

Compression:

Stored size: 626 Bytes

Contents

require 'mspec/matchers/method'

class HaveProtectedInstanceMethodMatcher < MethodMatcher
  def matches?(mod)
    @mod = mod
    mod.protected_instance_methods(@include_super).include? @method
  end

  def failure_message
    ["Expected #{@mod} to have protected instance method '#{@method.to_s}'",
     "but it does not"]
  end

  def negative_failure_message
    ["Expected #{@mod} NOT to have protected instance method '#{@method.to_s}'",
     "but it does"]
  end
end

class Object
  def have_protected_instance_method(method, include_super=true)
    HaveProtectedInstanceMethodMatcher.new method, include_super
  end
end

Version data entries

67 entries across 67 versions & 3 rubygems

Version Path
rhodes-3.2.0.beta.1 lib/extensions/mspec/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.17 lib/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.16 lib/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.15 lib/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.14 lib/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.13 lib/mspec/matchers/have_protected_instance_method.rb
mspec-1.5.12 lib/mspec/matchers/have_protected_instance_method.rb