Sha256: c91b6641d51557e9c17564d461541372d6a49d758440445e6224e25c0fb40824

Contents?: true

Size: 574 Bytes

Versions: 61

Compression:

Stored size: 574 Bytes

Contents

require 'mspec/matchers/method'

class HaveSingletonMethodMatcher < MethodMatcher
  def matches?(obj)
    @obj = obj
    obj.singleton_methods(@include_super).include? @method
  end

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

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

class Object
  def have_singleton_method(method, include_super=true)
    HaveSingletonMethodMatcher.new method, include_super
  end
end

Version data entries

61 entries across 61 versions & 3 rubygems

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