Sha256: 466810f97a6f5661620535644c981d967834a7e2dfe86cc6ceb8e3259f04fb04

Contents?: true

Size: 615 Bytes

Versions: 107

Compression:

Stored size: 615 Bytes

Contents

require 'mspec/matchers/method'

class HavePublicInstanceMethodMatcher < MethodMatcher
  def matches?(mod)
    @mod = mod
    mod.public_instance_methods(@include_super).include? @method.to_sym
  end

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

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

class Object
  def have_public_instance_method(method, include_super=true)
    HavePublicInstanceMethodMatcher.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_public_instance_method.rb
rhodes-3.1.1.beta lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0.beta.5 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0.beta.4 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0.beta.3 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0.beta.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.1.0.beta.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.2.beta.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.8 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.7 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.6 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.5 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.4 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.3 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.1.beta.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.0 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.0.0.beta.7 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb