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.
Instance Method Summary collapse
- #execute ⇒ Object
- #expected_failures ⇒ Object
-
#initialize(document) ⇒ Tester
constructor
A new instance of Tester.
- #total ⇒ Object
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 |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/docspec/tester.rb', line 18 def execute document.examples.each do |example| if example.passing? say "!txtgrn!PASS: #{example.label}" else @errors += 1 say "!txtred!FAIL: #{example.label}" say "---" puts example.diff say "---" end end errors == expected_failures end |
#expected_failures ⇒ Object
34 35 36 |
# File 'lib/docspec/tester.rb', line 34 def expected_failures ENV['DOCSPEC_EXPECTED_FAILURES']&.to_i || 0 end |
#total ⇒ Object
14 15 16 |
# File 'lib/docspec/tester.rb', line 14 def total @total ||= document.examples.count end |