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) ⇒ TestCase
constructor
A new instance of TestCase.
Constructor Details
permalink #initialize(name, parent = nil) ⇒ TestCase
Returns a new instance of TestCase.
397 398 399 400 401 402 403 404 405 |
# File 'lib/test/spec.rb', line 397 def initialize(name, parent=nil) @testcase = Class.new(Test::Unit::TestCase) { include InstanceMethods extend ClassMethods } @@POSITION = @@POSITION + 1 @testcase.init(name, @@POSITION, parent) end |
Instance Attribute Details
permalink #name ⇒ Object (readonly)
Returns the value of attribute name.
308 309 310 |
# File 'lib/test/spec.rb', line 308 def name @name end |
Instance Method Details
permalink #add(&block) ⇒ Object
407 408 409 410 411 412 |
# File 'lib/test/spec.rb', line 407 def add(&block) raise ArgumentError, "context needs a block" if block.nil? @testcase.class_eval(&block) self end |