Class: Lemon::TestClassMethod
- Inherits:
-
TestMethod
- Object
- TestCase
- TestMethod
- Lemon::TestClassMethod
- Defined in:
- lib/lemon/test_class_method.rb
Overview
Subclass of TestMethod used for class methods. It’s basically the same class.
Defined Under Namespace
Classes: DSL
Instance Attribute Summary
Attributes inherited from TestMethod
Attributes inherited from TestCase
#advice, #context, #label, #setup, #skip, #target, #tests
Instance Method Summary collapse
- #class_method? ⇒ Boolean
-
#name ⇒ Object
If class method, returns target method’s name prefixed with double colons.
-
#target_class ⇒ Object
For a class method, the target class is the meta-class.
-
#to_s ⇒ Object
Returns the prefixed method name.
-
#type ⇒ Object
Description of the type of test case.
-
#unit ⇒ Object
Returns the fully qulaified name of the target method.
Methods inherited from TestMethod
#initialize, #raise_pending, #run, #validate_settings
Methods inherited from TestCase
#domain, #domain_class, #each, #evaluate, #initialize, #run, #scope, #size, #skip!, #skip?, #tags, #validate_settings
Constructor Details
This class inherits a constructor from Lemon::TestMethod
Instance Method Details
#class_method? ⇒ Boolean
39 40 41 |
# File 'lib/lemon/test_class_method.rb', line 39 def class_method? true end |
#name ⇒ Object
If class method, returns target method’s name prefixed with double colons. If instance method, then returns target method’s name prefixed with hash character.
18 19 20 |
# File 'lib/lemon/test_class_method.rb', line 18 def name "::#{target}" end |
#target_class ⇒ Object
For a class method, the target class is the meta-class.
34 35 36 |
# File 'lib/lemon/test_class_method.rb', line 34 def target_class @target_class ||= (class << context.target; self; end) end |
#to_s ⇒ Object
Returns the prefixed method name.
23 24 25 |
# File 'lib/lemon/test_class_method.rb', line 23 def to_s "::#{target}" end |
#type ⇒ Object
Description of the type of test case.
11 12 13 |
# File 'lib/lemon/test_class_method.rb', line 11 def type 'Class Method' end |
#unit ⇒ Object
Returns the fully qulaified name of the target method. This is the standard interface used by RubyTest.
29 30 31 |
# File 'lib/lemon/test_class_method.rb', line 29 def unit "#{context}.#{target}" end |