Class: Lemon::TestClassMethod

Inherits:
TestMethod show all
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

#tested

Attributes inherited from TestCase

#advice, #context, #label, #setup, #skip, #target, #tests

Instance Method Summary collapse

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

Returns:

  • (Boolean)


39
40
41
# File 'lib/lemon/test_class_method.rb', line 39

def class_method?
  true
end

#nameObject

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_classObject

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_sObject

Returns the prefixed method name.



23
24
25
# File 'lib/lemon/test_class_method.rb', line 23

def to_s
  "::#{target}"
end

#typeObject

Description of the type of test case.



11
12
13
# File 'lib/lemon/test_class_method.rb', line 11

def type
  'Class Method'
end

#unitObject

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