Sha256: 212a81a2aeaa64f2bfdb2cf32eb303a9986622ae08c794f2d08be3d6f67cbacd

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

require 'rspec/core/formatters/base_formatter'

class RSpec2Formatter < RSpec::Core::Formatters::ProgressFormatter
  
  def rspactor_title
    "RSpec results"
  end
  
  def rspactor_message
    message = "#{@example_count} examples, #{failure_count} failures"
    if pending_count > 0
      message << " (#{pending_count} pending)"
    end
    message << "\nin #{format_seconds(duration)} seconds"
    message
  end
  
  # failed | pending | success
  def rspactor_image_path
    icon = if failure_count > 0
      'failed'
    elsif pending_count > 0
      'pending'
    else
      'success'
    end
    File.expand_path(File.dirname(__FILE__) + "/images/#{icon}.png")
  end
  
private
  
  def failure_count
    failed_examples.size
  end
  
  def pending_count
    pending_examples.size
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspactor-0.7.0.beta.3 lib/formatters/rspec2_formatter.rb
rspactor-0.7.0.beta.2 lib/formatters/rspec2_formatter.rb