Sha256: 7710bb64696bbf3ef4e16dcc9f19d1e16dbc059c7c692cb40f89fa22e500e618

Contents?: true

Size: 608 Bytes

Versions: 67

Compression:

Stored size: 608 Bytes

Contents

require 'mspec/matchers/method'

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

67 entries across 67 versions & 3 rubygems

Version Path
rhodes-3.3.2.beta.3 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.2.beta.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.2.beta.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.0 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.0.beta.3 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.0.beta.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.3.0.beta.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.3 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.2.beta lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.1 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.9 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.8 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.7 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.6 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.5 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.4 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb
rhodes-3.2.0.beta.2 lib/extensions/mspec/mspec/matchers/have_public_instance_method.rb