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(group, example, exception) ⇒ Failure

Returns a new instance of Failure.



136
137
138
# File 'lib/spec/runner/reporter.rb', line 136

def initialize(group, example, exception)
  @group, @example, @exception = group, example, exception
end

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



134
135
136
# File 'lib/spec/runner/reporter.rb', line 134

def example
  @example
end

#exceptionObject (readonly)

Returns the value of attribute exception.



134
135
136
# File 'lib/spec/runner/reporter.rb', line 134

def exception
  @exception
end

Instance Method Details

#expectation_not_met?Boolean

Returns:

  • (Boolean)


154
155
156
# File 'lib/spec/runner/reporter.rb', line 154

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

#headerObject



140
141
142
143
144
145
146
147
148
# File 'lib/spec/runner/reporter.rb', line 140

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)


150
151
152
# File 'lib/spec/runner/reporter.rb', line 150

def pending_fixed?
  @exception.is_a?(Spec::Example::PendingExampleFixedError)
end