Sha256: d4feb61ffb4022fd590ebedada5e91d317812dd052bd45adb8942ed134f36e29

Contents?: true

Size: 778 Bytes

Versions: 4

Compression:

Stored size: 778 Bytes

Contents

require 'rspec/core/formatters/base_text_formatter'
require 'terminal-notifier'

class Nc < RSpec::Core::Formatters::BaseTextFormatter
  def dump_summary(duration, example_count, failure_count, pending_count)
    body = []
    body << "Finished in #{format_duration duration}"
    body << summary_line(example_count, failure_count, pending_count)

    name = File.basename(File.expand_path '.')

    title = if failure_count > 0
      "\u26D4 #{name}: #{failure_count} failed example#{failure_count == 1 ? nil : 's'}"
    else
      "\u2705 #{name}: Success"
    end

    say title, body.join("\n")
  end

  def dump_pending; end
  def dump_failures; end
  def message(message); end

  private

  def say(title, body)
    TerminalNotifier.notify body, :title => title
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rspec-nc-0.0.6 lib/nc.rb
rspec-nc-0.0.5 lib/nc.rb
rspec-nc-0.0.4 lib/nc.rb
rspec-nc-0.0.3 lib/nc.rb