Class: Waw::WSpec::Suite
Overview
A suite of wspec scenarios
Instance Attribute Summary collapse
-
#assertion_count ⇒ Object
How many assertions?.
-
#error_count ⇒ Object
How many errors?.
-
#failure_count ⇒ Object
How many failures?.
Instance Method Summary collapse
-
#initialize(scenarios) ⇒ Suite
constructor
Creates a suite with given scenarios.
-
#run(waw_kernel) ⇒ Object
Runs the suite.
-
#scenario_count ⇒ Object
How many scenarios?.
Constructor Details
#initialize(scenarios) ⇒ Suite
Creates a suite with given scenarios
16 17 18 19 |
# File 'lib/waw/wspec/suite.rb', line 16 def initialize(scenarios) @scenarios = scenarios @assertion_count, @failure_count, @error_count = 0, 0, 0 end |
Instance Attribute Details
#assertion_count ⇒ Object
How many assertions?
7 8 9 |
# File 'lib/waw/wspec/suite.rb', line 7 def assertion_count @assertion_count end |
#error_count ⇒ Object
How many errors?
13 14 15 |
# File 'lib/waw/wspec/suite.rb', line 13 def error_count @error_count end |
#failure_count ⇒ Object
How many failures?
10 11 12 |
# File 'lib/waw/wspec/suite.rb', line 10 def failure_count @failure_count end |
Instance Method Details
#run(waw_kernel) ⇒ Object
Runs the suite
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/waw/wspec/suite.rb', line 27 def run(waw_kernel) @scenarios.each do |sc| begin STDOUT.write('.') STDOUT.flush sc.run(waw_kernel) self.assertion_count += sc.assertion_count rescue Test::Unit::AssertionFailedError => ex # for ruby 1.8.6 puts "\nAssertion failed #{sc.name}: #{ex.}" puts ex.backtrace[0] self.failure_count += 1 rescue MiniTest::Assertion => ex # for ruby 1.9.1 puts "\nAssertion failed #{sc.name}: #{ex.}" puts ex.backtrace[0] self.failure_count += 1 rescue Exception => ex puts "Fatal error #{sc.name}: #{ex.}" puts ex.backtrace.join("\n") self.error_count += 1 end end end |
#scenario_count ⇒ Object
How many scenarios?
22 23 24 |
# File 'lib/waw/wspec/suite.rb', line 22 def scenario_count @scenarios.size end |