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

Inherits:
Object
  • Object
show all
Defined in:
lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example, exception) ⇒ Failure

Returns a new instance of Failure.



137
138
139
140
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 137

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

Instance Attribute Details

#exampleObject (readonly)

Returns the value of attribute example.



135
136
137
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 135

def example
  @example
end

#exceptionObject (readonly)

Returns the value of attribute exception.



135
136
137
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 135

def exception
  @exception
end

Instance Method Details

#expectation_not_met?Boolean

Returns:

  • (Boolean)


156
157
158
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 156

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

#headerObject



142
143
144
145
146
147
148
149
150
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 142

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)


152
153
154
# File 'lib/gems/rspec-1.1.12/lib/spec/runner/reporter.rb', line 152

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