Class: Sapphire::DSL::TestPlans::TestPlan
- Defined in:
- lib/sapphire/DSL/TestPlans/TestPlan.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #Add(item) ⇒ Object
- #AddHandler(handler) ⇒ Object
- #Cover(item) ⇒ Object
- #execute ⇒ Object
-
#initialize(text, &block) ⇒ TestPlan
constructor
A new instance of TestPlan.
- #Report(&block) ⇒ Object
Constructor Details
#initialize(text, &block) ⇒ TestPlan
Returns a new instance of TestPlan.
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 15 def initialize(text, &block) @value = text @text = text.to_s @block = block @items = [] @handlers = [] @coverage = [] AddHandler :file => FileHandler.new AddHandler :path => PathHandler.new end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
11 12 13 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 11 def block @block end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
13 14 15 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 13 def text @text end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
12 13 14 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 12 def value @value end |
Instance Method Details
#Add(item) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 33 def Add(item) item.keys.each do |key| @handlers.each do |handler| handler.keys.each do |handler_key| if(handler_key == key) handler[handler_key].Handle item[key] end end end end end |
#AddHandler(handler) ⇒ Object
45 46 47 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 45 def AddHandler(handler) @handlers << handler end |
#Cover(item) ⇒ Object
29 30 31 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 29 def Cover(item) @coverage << item end |
#execute ⇒ Object
49 50 51 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 49 def execute @block.call end |
#Report(&block) ⇒ Object
53 54 55 56 57 |
# File 'lib/sapphire/DSL/TestPlans/TestPlan.rb', line 53 def Report(&block) $instances.each do |reporter| block.call reporter end end |