Sha256: 026ecf50abac118254b088c53736e6462d1e57835db88084ec211c241ddd354d

Contents?: true

Size: 524 Bytes

Versions: 107

Compression:

Stored size: 524 Bytes

Contents

require 'mspec/matchers/method'

class HaveMethodMatcher < MethodMatcher
  def matches?(mod)
    @mod = mod
    @mod.methods(@include_super).include? @method.to_sym
  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

107 entries across 83 versions & 1 rubygems

Version Path
rhodes-3.1.1 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.1.beta lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0.beta.5 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0.beta.4 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0.beta.3 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0.beta.2 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.1.0.beta.1 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.2 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.2.beta.1 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.8 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.7 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.6 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.5 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.4 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.3 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.1.beta.2 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.0 lib/extensions/mspec/mspec/matchers/have_method.rb
rhodes-3.0.0.beta.7 lib/extensions/mspec/mspec/matchers/have_method.rb