class ClipboardFormatter

Constants

VERSION

Public Class Methods

new(*) click to toggle source
# File lib/clipboard_formatter.rb, line 9
def initialize(*)
end

Public Instance Methods

dump_summary(notification) click to toggle source
# File lib/clipboard_formatter.rb, line 12
def dump_summary(notification)
  if notification.failed_examples.present?
    locations = Hash.new{ |h,k| h[k] = [] }

    notification.failed_examples.each{ |fe|
      locations[fe.metadata[:file_path]] << fe.metadata[:line_number]
    }

    Clipboard.copy "rspec " + locations.map{ |file_path, line_numbers|
      [file_path, *line_numbers]*":"
    }*" "
  end
end