Class: TestBelt::Matchers::HaveClassMethods::Matcher
- Defined in:
- lib/test_belt/matchers/have_class_methods.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #desc ⇒ Object
-
#initialize(method) ⇒ Matcher
constructor
A new instance of Matcher.
- #test ⇒ Object
Constructor Details
#initialize(method) ⇒ Matcher
Returns a new instance of Matcher.
18 19 20 21 22 23 |
# File 'lib/test_belt/matchers/have_class_methods.rb', line 18 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 |
Instance Method Details
#desc ⇒ Object
25 26 27 |
# File 'lib/test_belt/matchers/have_class_methods.rb', line 25 def desc "respond to class method ##{@method}" end |
#test ⇒ Object
29 30 31 32 33 |
# File 'lib/test_belt/matchers/have_class_methods.rb', line 29 def test using(@method) do |method| assert subject.class.respond_to?(method, true), "#{subject.class.name} does not have the class method ##{method}" end end |