Class: Turn::TestMethod
- Inherits:
-
Object
- Object
- Turn::TestMethod
- Defined in:
- lib/turn/components/method.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
Returns the value of attribute backtrace.
-
#file ⇒ Object
Returns the value of attribute file.
-
#message ⇒ Object
Returns the value of attribute message.
-
#name ⇒ Object
Returns the value of attribute name.
-
#raised ⇒ Object
Returns the value of attribute raised.
Instance Method Summary collapse
- #error!(exception) ⇒ Object
- #error? ⇒ Boolean
- #fail!(assertion) ⇒ Object
- #fail? ⇒ Boolean
-
#initialize(name) ⇒ TestMethod
constructor
A new instance of TestMethod.
-
#pass? ⇒ Boolean
TODO: should this include ‘or @skip`?.
- #skip!(assertion) ⇒ Object
- #skip? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ TestMethod
Returns a new instance of TestMethod.
11 12 13 14 15 16 17 18 19 |
# File 'lib/turn/components/method.rb', line 11 def initialize(name) @name = name @fail = false @error = false @skip = false @raised = nil @message = nil @backtrace = [] end |
Instance Attribute Details
#backtrace ⇒ Object
Returns the value of attribute backtrace.
9 10 11 |
# File 'lib/turn/components/method.rb', line 9 def backtrace @backtrace end |
#file ⇒ Object
Returns the value of attribute file.
6 7 8 |
# File 'lib/turn/components/method.rb', line 6 def file @file end |
#message ⇒ Object
Returns the value of attribute message.
8 9 10 |
# File 'lib/turn/components/method.rb', line 8 def @message end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/turn/components/method.rb', line 5 def name @name end |
#raised ⇒ Object
Returns the value of attribute raised.
7 8 9 |
# File 'lib/turn/components/method.rb', line 7 def raised @raised end |
Instance Method Details
#error!(exception) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/turn/components/method.rb', line 28 def error!(exception) @fail, @error, @skip = false, true, false @raised = exception @message = exception. @backtrace = exception.backtrace end |
#error? ⇒ Boolean
43 |
# File 'lib/turn/components/method.rb', line 43 def error? ; @error ; end |
#fail!(assertion) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/turn/components/method.rb', line 21 def fail!(assertion) @fail, @error, @skip = true, false, false @raised = assertion @message = assertion. @backtrace = assertion.backtrace end |
#fail? ⇒ Boolean
42 |
# File 'lib/turn/components/method.rb', line 42 def fail? ; @fail ; end |
#pass? ⇒ Boolean
TODO: should this include ‘or @skip`?
47 |
# File 'lib/turn/components/method.rb', line 47 def pass? ; !(@fail or @error) ; end |
#skip!(assertion) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/turn/components/method.rb', line 35 def skip!(assertion) @fail, @error, @skip = false, false, true @raised = assertion @message = assertion. @backtrace = assertion.backtrace end |
#skip? ⇒ Boolean
44 |
# File 'lib/turn/components/method.rb', line 44 def skip? ; @skip ; end |
#to_s ⇒ Object
49 |
# File 'lib/turn/components/method.rb', line 49 def to_s ; name ; end |