Class: Speq::Group
- Inherits:
-
Object
- Object
- Speq::Group
- Defined in:
- lib/speq.rb,
lib/speq/string_fmt.rb
Overview
Common interface for all for Test and Expression
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#units ⇒ Object
readonly
Returns the value of attribute units.
Instance Method Summary collapse
- #<<(unit) ⇒ Object
- #error? ⇒ Boolean
- #fail? ⇒ Boolean
- #full_context ⇒ Object
- #indent ⇒ Object
-
#initialize(parent = nil) ⇒ Group
constructor
A new instance of Group.
- #newline ⇒ Object
- #outcome ⇒ Object
- #pass? ⇒ Boolean
- #report ⇒ Object
Constructor Details
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
48 49 50 |
# File 'lib/speq.rb', line 48 def context @context end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
48 49 50 |
# File 'lib/speq.rb', line 48 def parent @parent end |
#units ⇒ Object (readonly)
Returns the value of attribute units.
48 49 50 |
# File 'lib/speq.rb', line 48 def units @units end |
Instance Method Details
#<<(unit) ⇒ Object
72 73 74 |
# File 'lib/speq.rb', line 72 def <<(unit) units << unit end |
#error? ⇒ Boolean
68 69 70 |
# File 'lib/speq.rb', line 68 def error? outcome.error? end |
#fail? ⇒ Boolean
64 65 66 |
# File 'lib/speq.rb', line 64 def fail? outcome.fail? end |
#full_context ⇒ Object
76 77 78 |
# File 'lib/speq.rb', line 76 def full_context parent ? context.merge(parent.full_context) : context end |
#indent ⇒ Object
17 18 19 |
# File 'lib/speq/string_fmt.rb', line 17 def indent parent ? parent.indent + ' ' : '' end |
#newline ⇒ Object
21 22 23 |
# File 'lib/speq/string_fmt.rb', line 21 def newline "\n#{indent}" end |
#outcome ⇒ Object
56 57 58 |
# File 'lib/speq.rb', line 56 def outcome Outcome.aggregate(units.map(&:outcome)) end |
#pass? ⇒ Boolean
60 61 62 |
# File 'lib/speq.rb', line 60 def pass? outcome.pass? end |
#report ⇒ Object
13 14 15 |
# File 'lib/speq/string_fmt.rb', line 13 def report outcome.report end |