Sha256: 22b435e286d1cfab8eeb344e3aa7d3d96e813510d83b968fac9b72e961514162
Contents?: true
Size: 1.62 KB
Versions: 24
Compression:
Stored size: 1.62 KB
Contents
module Locomotive module RSpec module Matchers class IncludeInstanceMethod #:nodoc: def initialize(meth) @meth = meth end def matches?(klass) @klass = klass if RUBY_VERSION =~ /1\.9/ klass.instance_methods.include?(@meth.to_sym) == true else klass.instance_methods.include?(@meth.to_s) == true end end def failure_message "#{@klass} expected to include the instance method #{@meth}" end def negative_failure_message "#{@klass} expected to not include the instance method #{@meth} but included it.\n" end def description "include instance method #{@meth}" end end def include_instance_method(meth) IncludeInstanceMethod.new(meth) end class IncludeClassMethod #:nodoc: def initialize(meth) @meth = meth end def matches?(klass) @klass = klass if RUBY_VERSION =~ /1\.9/ klass.methods.include?(@meth.to_sym) == true else klass.methods.include?(@meth.to_s) == true end end def failure_message "#{@klass} expected to include the class method #{@meth}" end def negative_failure_message "#{@klass} expected to not include the class method #{@meth} but included it.\n" end def description "include class method #{@meth}" end end def include_class_method(meth) IncludeClassMethod.new(meth) end end end end
Version data entries
24 entries across 24 versions & 1 rubygems