Class: Uspec::Harness
- Inherits:
-
Object
- Object
- Uspec::Harness
- Defined in:
- lib/uspec/harness.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
Returns the value of attribute cli.
-
#define ⇒ Object
Returns the value of attribute define.
Instance Method Summary collapse
-
#initialize(cli) ⇒ Harness
constructor
A new instance of Harness.
- #spec_eval(description, &block) ⇒ Object
- #stats ⇒ Object
Constructor Details
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
11 12 13 |
# File 'lib/uspec/harness.rb', line 11 def cli @cli end |
#define ⇒ Object
Returns the value of attribute define.
11 12 13 |
# File 'lib/uspec/harness.rb', line 11 def define @define end |
Instance Method Details
#spec_eval(description, &block) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/uspec/harness.rb', line 17 def spec_eval description, &block state = 0 print ' -- ', description if block then begin state = 1 raw_result = Uspec::Spec.new(self, description, &block).__uspec_block state = 2 rescue Exception => raw_result state = 3 end end result = Uspec::Result.new description, raw_result, caller unless block then state = 4 result.pending! end stats << result print ': ', result.pretty, "\n" rescue => error state = 5 = <<-MSG #{error.class} : #{error.} Uspec encountered an internal error, please report this bug: https://github.com/acook/uspec/issues/new \t#{error.backtrace.join "\n\t"} MSG puts warn stats << Uspec::Result.new(, error, caller) ensure cli.handle_interrupt! result.raw return [state, error, result, raw_result] end |
#stats ⇒ Object
13 14 15 |
# File 'lib/uspec/harness.rb', line 13 def stats cli.stats end |