Sha256: 0adf67aa28214b4589a6173c3e9b161208e54cfb10421ce096305311d26e3992
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
require 'mspec/utils/version' class HaveInstanceMethodMatcher def initialize(method, include_super=true) @include_super = include_super version = SpecVersion.new(RUBY_VERSION) <=> "1.9" @method = version < 0 ? method.to_s : method end def matches?(mod) @mod = mod mod.instance_methods(@include_super).include? @method end def failure_message ["Expected #{@mod} to have private method '#{@method.to_s}'", "but it does not"] end def negative_failure_message ["Expected #{@mod} NOT to have private method '#{@method.to_s}'", "but it does"] end end class Object def have_instance_method(method, include_super=true) HaveInstanceMethodMatcher.new method, include_super end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mspec-1.5.7 | lib/mspec/matchers/have_instance_method.rb |