Class: Cucumber::Core::Test::Result::Failed
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::Failed
- Includes:
- BooleanMethods
- Defined in:
- lib/cucumber/core/test/result/failed.rb
Constant Summary
Constants included from BooleanMethods
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Class Method Summary collapse
Instance Method Summary collapse
- #describe_to(visitor) ⇒ Object
-
#initialize(duration, exception) ⇒ Failed
constructor
A new instance of Failed.
- #to_message ⇒ Object
- #to_s ⇒ Object
- #to_sym ⇒ Object
- #with_appended_backtrace(step) ⇒ Object
- #with_duration(new_duration) ⇒ Object
- #with_filtered_backtrace(filter) ⇒ Object
Methods included from BooleanMethods
Constructor Details
#initialize(duration, exception) ⇒ Failed
Returns a new instance of Failed.
19 20 21 22 23 24 25 |
# File 'lib/cucumber/core/test/result/failed.rb', line 19 def initialize(duration, exception) raise ArgumentError unless duration raise ArgumentError unless exception @duration = duration @exception = exception end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
13 14 15 |
# File 'lib/cucumber/core/test/result/failed.rb', line 13 def duration @duration end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
13 14 15 |
# File 'lib/cucumber/core/test/result/failed.rb', line 13 def exception @exception end |
Class Method Details
.ok? ⇒ Boolean
15 16 17 |
# File 'lib/cucumber/core/test/result/failed.rb', line 15 def self.ok? false end |
Instance Method Details
#describe_to(visitor) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/cucumber/core/test/result/failed.rb', line 27 def describe_to(visitor, *) visitor.failed(*) visitor.duration(duration, *) visitor.exception(exception, *) if exception self end |
#to_message ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cucumber/core/test/result/failed.rb', line 42 def begin = exception.backtrace.join("\n") rescue NoMethodError = '' end Cucumber::Messages::TestStepResult.new( status: Cucumber::Messages::TestStepResultStatus::FAILED, duration: duration., message: ) end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/cucumber/core/test/result/failed.rb', line 34 def to_s '✗' end |
#to_sym ⇒ Object
38 39 40 |
# File 'lib/cucumber/core/test/result/failed.rb', line 38 def to_sym :failed end |
#with_appended_backtrace(step) ⇒ Object
60 61 62 63 |
# File 'lib/cucumber/core/test/result/failed.rb', line 60 def with_appended_backtrace(step) exception.backtrace << step.backtrace_line if step.respond_to?(:backtrace_line) self end |
#with_duration(new_duration) ⇒ Object
56 57 58 |
# File 'lib/cucumber/core/test/result/failed.rb', line 56 def with_duration(new_duration) self.class.new(new_duration, exception) end |
#with_filtered_backtrace(filter) ⇒ Object
65 66 67 |
# File 'lib/cucumber/core/test/result/failed.rb', line 65 def with_filtered_backtrace(filter) self.class.new(duration, filter.new(exception.dup).exception) end |