Class: Speq::Test
Overview
A test group is a collection of tests with a description
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Attributes inherited from Group
Instance Method Summary collapse
-
#initialize(description, parent = nil, &block) ⇒ Test
constructor
A new instance of Test.
- #run(&block) ⇒ Object
- #speq(description, &block) ⇒ Object
- #title ⇒ Object
- #to_s ⇒ Object
Methods inherited from Group
#<<, #error?, #fail?, #full_context, #indent, #newline, #outcome, #pass?, #report
Constructor Details
#initialize(description, parent = nil, &block) ⇒ Test
Returns a new instance of Test.
85 86 87 88 89 |
# File 'lib/speq.rb', line 85 def initialize(description, parent = nil, &block) super(parent) @description = description run &block if block_given? end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
83 84 85 |
# File 'lib/speq.rb', line 83 def description @description end |
Instance Method Details
#run(&block) ⇒ Object
91 92 93 |
# File 'lib/speq.rb', line 91 def run(&block) TestBlock.new(self, &block) end |
#speq(description, &block) ⇒ Object
95 96 97 |
# File 'lib/speq.rb', line 95 def speq(description, &block) self << Test.new(description, self, &block) end |
#title ⇒ Object
27 28 29 |
# File 'lib/speq/string_fmt.rb', line 27 def title "#{outcome} #{description}" end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/speq/string_fmt.rb', line 31 def to_s [newline, title, units.join(''), parent ? '' : newline + report].join('') end |