Class: Spec::Runner::Reporter::Failure
- Inherits:
-
Object
- Object
- Spec::Runner::Reporter::Failure
- Defined in:
- lib/specjour/marshalable_rspec_failure.rb
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#exception_class_name ⇒ Object
readonly
Returns the value of attribute exception_class_name.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #expectation_not_met? ⇒ Boolean
-
#initialize(group_description, example_description, exception) ⇒ Failure
constructor
A new instance of Failure.
- #pending_fixed? ⇒ Boolean
- #set_header ⇒ Object
Constructor Details
#initialize(group_description, example_description, exception) ⇒ Failure
Returns a new instance of Failure.
5 6 7 8 9 10 11 12 13 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 5 def initialize(group_description, example_description, exception) @example_name = "#{group_description} #{example_description}" @message = exception. @backtrace = exception.backtrace @exception_class_name = exception.class.name @pending_fixed = exception.is_a?(Spec::Example::PendingExampleFixedError) @exception_not_met = exception.is_a?(Spec::Expectations::ExpectationNotMetError) set_header end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace.
3 4 5 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 3 def backtrace @backtrace end |
#exception_class_name ⇒ Object (readonly)
Returns the value of attribute exception_class_name.
3 4 5 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 3 def exception_class_name @exception_class_name end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
3 4 5 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 3 def header @header end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 3 def @message end |
Instance Method Details
#expectation_not_met? ⇒ Boolean
29 30 31 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 29 def expectation_not_met? @exception_not_met end |
#pending_fixed? ⇒ Boolean
25 26 27 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 25 def pending_fixed? @pending_fixed end |
#set_header ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/specjour/marshalable_rspec_failure.rb', line 15 def set_header if expectation_not_met? @header = "'#{@example_name}' FAILED" elsif pending_fixed? @header = "'#{@example_name}' FIXED" else @header = "#{exception_class_name} in '#{@example_name}'" end end |