Class: Cucumber::Core::Test::Result::Failed
- Inherits:
-
Object
- Object
- Cucumber::Core::Test::Result::Failed
- Defined in:
- lib/cucumber/core/test/result.rb
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, *args) ⇒ Object
-
#initialize(duration, exception) ⇒ Failed
constructor
A new instance of Failed.
- #ok? ⇒ Boolean
- #to_message ⇒ Object
- #to_s ⇒ Object
- #with_appended_backtrace(step) ⇒ Object
- #with_duration(new_duration) ⇒ Object
- #with_filtered_backtrace(filter) ⇒ Object
Constructor Details
#initialize(duration, exception) ⇒ Failed
Returns a new instance of Failed.
108 109 110 111 112 113 114 |
# File 'lib/cucumber/core/test/result.rb', line 108 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.
102 103 104 |
# File 'lib/cucumber/core/test/result.rb', line 102 def duration @duration end |
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
102 103 104 |
# File 'lib/cucumber/core/test/result.rb', line 102 def exception @exception end |
Class Method Details
.ok? ⇒ Boolean
104 105 106 |
# File 'lib/cucumber/core/test/result.rb', line 104 def self.ok?(*) false end |
Instance Method Details
#describe_to(visitor, *args) ⇒ Object
116 117 118 119 120 121 |
# File 'lib/cucumber/core/test/result.rb', line 116 def describe_to(visitor, *args) visitor.failed(*args) visitor.duration(duration, *args) visitor.exception(exception, *args) if exception self end |
#ok? ⇒ Boolean
141 142 143 |
# File 'lib/cucumber/core/test/result.rb', line 141 def ok?(*) self.class.ok? end |
#to_message ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/cucumber/core/test/result.rb', line 127 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
123 124 125 |
# File 'lib/cucumber/core/test/result.rb', line 123 def to_s '✗' end |
#with_appended_backtrace(step) ⇒ Object
149 150 151 152 |
# File 'lib/cucumber/core/test/result.rb', line 149 def with_appended_backtrace(step) exception.backtrace << step.backtrace_line if step.respond_to?(:backtrace_line) self end |
#with_duration(new_duration) ⇒ Object
145 146 147 |
# File 'lib/cucumber/core/test/result.rb', line 145 def with_duration(new_duration) self.class.new(new_duration, exception) end |
#with_filtered_backtrace(filter) ⇒ Object
154 155 156 |
# File 'lib/cucumber/core/test/result.rb', line 154 def with_filtered_backtrace(filter) self.class.new(duration, filter.new(exception.dup).exception) end |