Class: HavePrivateInstanceMethodMatcher

Inherits:
MethodMatcher show all
Defined in:
lib/extensions/mspec/mspec/matchers/have_private_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/extensions/mspec/mspec/matchers/have_private_instance_method.rb', line 9

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

#matches?(mod) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#negative_failure_messageObject



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

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