Class: Spec::Runner::Reporter::Failure

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/runner/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example_name, exception) ⇒ Failure

Returns a new instance of Failure.



99
100
101
102
# File 'lib/spec/runner/reporter.rb', line 99

def initialize(example_name, exception)
  @example_name = example_name
  @exception = exception
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



97
98
99
# File 'lib/spec/runner/reporter.rb', line 97

def exception
  @exception
end

Instance Method Details

#expectation_not_met?Boolean

Returns:

  • (Boolean)


118
119
120
# File 'lib/spec/runner/reporter.rb', line 118

def expectation_not_met?
  @exception.is_a?(Spec::Expectations::ExpectationNotMetError)
end

#headerObject



104
105
106
107
108
109
110
111
112
# File 'lib/spec/runner/reporter.rb', line 104

def header
  if expectation_not_met?
    "'#{@example_name}' FAILED"
  elsif pending_fixed?
    "'#{@example_name}' FIXED"
  else
    "#{@exception.class.name} in '#{@example_name}'"
  end
end

#pending_fixed?Boolean

Returns:

  • (Boolean)


114
115
116
# File 'lib/spec/runner/reporter.rb', line 114

def pending_fixed?
  @exception.is_a?(Spec::DSL::PendingFixedError)
end