Class: Test::Spec::TestCase
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- @@POSITION =
0
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#testcase ⇒ Object
readonly
Returns the value of attribute testcase.
Instance Method Summary collapse
- #add(&block) ⇒ Object
-
#initialize(name, parent = nil, superclass = Test::Unit::TestCase) ⇒ TestCase
constructor
A new instance of TestCase.
Constructor Details
#initialize(name, parent = nil, superclass = Test::Unit::TestCase) ⇒ TestCase
Returns a new instance of TestCase.
500 501 502 503 504 505 506 507 508 |
# File 'lib/test/spec.rb', line 500 def initialize(name, parent=nil, superclass=Test::Unit::TestCase) @testcase = Class.new(superclass) { include InstanceMethods extend ClassMethods } @@POSITION = @@POSITION + 1 @testcase.init(name, @@POSITION, parent) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
329 330 331 |
# File 'lib/test/spec.rb', line 329 def name @name end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
330 331 332 |
# File 'lib/test/spec.rb', line 330 def position @position end |
#testcase ⇒ Object (readonly)
Returns the value of attribute testcase.
328 329 330 |
# File 'lib/test/spec.rb', line 328 def testcase @testcase end |
Instance Method Details
#add(&block) ⇒ Object
510 511 512 513 514 515 |
# File 'lib/test/spec.rb', line 510 def add(&block) raise ArgumentError, "context needs a block" if block.nil? @testcase.class_eval(&block) self end |