Class: HaveProtectedInstanceMethodMatcher

Inherits:
MethodMatcher show all
Defined in:
lib/mspec/matchers/have_protected_instance_method.rb

Instance Method Summary collapse

Methods inherited from MethodMatcher

#initialize

Methods included from StringSymbolAdapter

#convert_name

Constructor Details

This class inherits a constructor from MethodMatcher

Instance Method Details

#failure_messageObject



9
10
11
12
# File 'lib/mspec/matchers/have_protected_instance_method.rb', line 9

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

#matches?(mod) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
# File 'lib/mspec/matchers/have_protected_instance_method.rb', line 4

def matches?(mod)
  @mod = mod
  mod.protected_instance_methods(@include_super).include? @method
end

#negative_failure_messageObject



14
15
16
17
# File 'lib/mspec/matchers/have_protected_instance_method.rb', line 14

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