Sha256: af0dc7c993c0a34b06dca40f973dcb56c58ff1a179b0ef2b6773a415dca341b7

Contents?: true

Size: 517 Bytes

Versions: 76

Compression:

Stored size: 517 Bytes

Contents

require 'mspec/matchers/method'

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

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

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

class Object
  def have_method(method, include_super=true)
    HaveMethodMatcher.new method, include_super
  end
end

Version data entries

76 entries across 76 versions & 4 rubygems

Version Path
rhodes-3.2.0.beta.1 lib/extensions/mspec/mspec/matchers/have_method.rb
mspec-1.5.17 lib/mspec/matchers/have_method.rb
mspec-1.5.16 lib/mspec/matchers/have_method.rb
mspec-1.5.15 lib/mspec/matchers/have_method.rb
mspec-1.5.14 lib/mspec/matchers/have_method.rb
mspec-1.5.13 lib/mspec/matchers/have_method.rb
rhodes-1.2.2 spec/app/mspec/matchers/have_method.rb
rhodes-framework-1.2.1 spec/app/mspec/matchers/have_method.rb
rhodes-framework-1.2.0 spec/app/mspec/matchers/have_method.rb
mspec-1.5.12 lib/mspec/matchers/have_method.rb
mspec-1.5.11 lib/mspec/matchers/have_method.rb
mspec-1.5.10 lib/mspec/matchers/have_method.rb
mspec-1.5.9 lib/mspec/matchers/have_method.rb
mspec-1.5.8 lib/mspec/matchers/have_method.rb
rhodes-framework-1.1.1 spec/app/mspec/matchers/have_method.rb
rhodes-framework-1.1.0 spec/app/mspec/matchers/have_method.rb