lib/nc.rb in rspec-nc-0.0.1 vs lib/nc.rb in rspec-nc-0.0.2
- old
+ new
@@ -1,10 +1,22 @@
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)
- say "Finished in #{duration} seconds", summary_line(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