Class: Dbtap::Tapper
Overview
The Tapper class provides the DSL for Dbtap#define_tests
It also drives the evaluation of all the tests via #run
Instance Attribute Summary collapse
-
#tests ⇒ Object
readonly
Returns the value of attribute tests.
Instance Method Summary collapse
-
#initialize ⇒ Tapper
constructor
A new instance of Tapper.
-
#run ⇒ Object
Drives the evaluation of each test, emitting TAP-compliant messages for each test.
Constructor Details
#initialize ⇒ Tapper
Returns a new instance of Tapper.
11 12 13 14 |
# File 'lib/dbtap/tapper.rb', line 11 def initialize @tests = [] db.extension :error_sql end |
Instance Attribute Details
#tests ⇒ Object (readonly)
Returns the value of attribute tests.
10 11 12 |
# File 'lib/dbtap/tapper.rb', line 10 def tests @tests end |
Instance Method Details
#run ⇒ Object
Drives the evaluation of each test, emitting TAP-compliant messages for each test
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/dbtap/tapper.rb', line 18 def run puts (1..tests.length).to_s tests.each_with_index do |test, i| begin if test.is_ok? ok(test, i) else not_ok(test, i) end rescue Sequel::DatabaseError puts $!.sql raise $! end end end |