Class: Docspec::Tester
- Inherits:
-
Object
- Object
- Docspec::Tester
- Includes:
- Colsole
- Defined in:
- lib/docspec/tester.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
- #before_codes ⇒ Object
- #execute ⇒ Object
-
#initialize(document) ⇒ Tester
constructor
A new instance of Tester.
Constructor Details
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
6 7 8 |
# File 'lib/docspec/tester.rb', line 6 def document @document end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/docspec/tester.rb', line 6 def errors @errors end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
6 7 8 |
# File 'lib/docspec/tester.rb', line 6 def total @total end |
Instance Method Details
#before_codes ⇒ Object
15 16 17 |
# File 'lib/docspec/tester.rb', line 15 def before_codes @before_codes ||= [] end |
#execute ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/docspec/tester.rb', line 19 def execute document.examples.each do |example| if example.empty? before_codes << example.code next end @total += 1 example.prepend before_codes if example.success? say "!txtgrn!PASS: #{example.label}" else @errors += 1 unless example.ignore_failure? say "!txtred!FAIL: #{example.label}" say "---" puts example.diff say "---" end end errors == 0 end |