Sha256: d7161fa6ff7b5ce7ed00159ba48ca29d73907f708a08e72926cea97abba9aeb6
Contents?: true
Size: 911 Bytes
Versions: 2
Compression:
Stored size: 911 Bytes
Contents
module TestBelt::Matchers module HaveClassMethods def self.included(receiver) receiver.send(:extend, ClassMethods) end module ClassMethods def have_class_methods(*meths) meths.collect do |meth| Matcher.new(meth) end end alias_method :have_class_method, :have_class_methods end class Matcher < ::TestBelt::Matchers::Base def initialize(method) unless method.kind_of?(::String) || method.kind_of?(::Symbol) raise ArgumentError, "please specify the method name using a string or symbol" end @method = method end def desc "respond to class method ##{@method}" end def test using(@method) do |method| assert subject.class.respond_to?(method), "#{subject.class.name} does not have the class method ##{method}" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
test-belt-1.1.1 | lib/test_belt/matchers/have_class_methods.rb |
test-belt-1.1.0 | lib/test_belt/matchers/have_class_methods.rb |