Parent

CI::Reporter::RSpec

Custom RSpec formatter used to hook into the spec runs and capture results.

Attributes

formatter[RW]
report_manager[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/ci/reporter/rspec.rb, line 78
def initialize(*args)
  super
  @formatter ||= RSpecFormatters::ProgressFormatter.new(*args)
  @report_manager = ReportManager.new("spec")
  @suite = nil
end

Public Instance Methods

add_behaviour(name) click to toggle source

rspec 0.9

# File lib/ci/reporter/rspec.rb, line 90
def add_behaviour(name)
  @formatter.add_behaviour(name)
  new_suite(name)
end
add_example_group(example_group) click to toggle source

Compatibility with rspec < 1.2.4

# File lib/ci/reporter/rspec.rb, line 96
def add_example_group(example_group)
  @formatter.add_example_group(example_group)
  new_suite(description_for(example_group))
end
close() click to toggle source
# File lib/ci/reporter/rspec.rb, line 173
def close
  @formatter.close
end
dump_failure(*args) click to toggle source
# File lib/ci/reporter/rspec.rb, line 160
def dump_failure(*args)
  @formatter.dump_failure(*args)
end
dump_failures(*args) click to toggle source
# File lib/ci/reporter/rspec.rb, line 156
def dump_failures(*args)
  @formatter.dump_failures(*args)
end
dump_pending() click to toggle source
# File lib/ci/reporter/rspec.rb, line 169
def dump_pending
  @formatter.dump_pending
end
dump_summary(*args) click to toggle source
# File lib/ci/reporter/rspec.rb, line 164
def dump_summary(*args)
  @formatter.dump_summary(*args)
  write_report
end
example_failed(name_or_example, *rest) click to toggle source
# File lib/ci/reporter/rspec.rb, line 118
def example_failed(name_or_example, *rest)
  @formatter.example_failed(name_or_example, *rest)

  # In case we fail in before(:all)
  example_started(name_or_example) if @suite.testcases.empty?

  if name_or_example.respond_to?(:execution_result) # RSpec 2
    failure = RSpec2Failure.new(name_or_example, @formatter)
  else
    failure = RSpecFailure.new(rest[1]) # example_failed(name, counter, failure) in RSpec 1
  end

  spec = @suite.testcases.last
  spec.finish
  spec.name = description_for(name_or_example)
  spec.failures << failure
end
example_group_finished(example_group) click to toggle source
# File lib/ci/reporter/rspec.rb, line 107
def example_group_finished(example_group)
  @formatter.example_group_finished(example_group)
end
example_group_started(example_group) click to toggle source

rspec >= 1.2.4

# File lib/ci/reporter/rspec.rb, line 102
def example_group_started(example_group)
  @formatter.example_group_started(example_group)
  new_suite(description_for(example_group))
end
example_passed(name_or_example) click to toggle source
# File lib/ci/reporter/rspec.rb, line 136
def example_passed(name_or_example)
  @formatter.example_passed(name_or_example)
  spec = @suite.testcases.last
  spec.finish
  spec.name = description_for(name_or_example)
end
example_pending(*args) click to toggle source
# File lib/ci/reporter/rspec.rb, line 143
def example_pending(*args)
  @formatter.example_pending(*args)
  name = description_for(args[0])
  spec = @suite.testcases.last
  spec.finish
  spec.name = "#{name} (PENDING)"
  spec.skipped = true
end
example_started(name_or_example) click to toggle source
# File lib/ci/reporter/rspec.rb, line 111
def example_started(name_or_example)
  @formatter.example_started(name_or_example)
  spec = TestCase.new
  @suite.testcases << spec
  spec.start
end
start(spec_count) click to toggle source
# File lib/ci/reporter/rspec.rb, line 85
def start(spec_count)
  @formatter.start(spec_count)
end
start_dump() click to toggle source
# File lib/ci/reporter/rspec.rb, line 152
def start_dump
  @formatter.start_dump
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.