Permalink
Browse files

Add current directory name to the title.

  • Loading branch information...
1 parent 553f98e commit a03c4372957df00fd0e2fca06b45d970f2531a04 @twe4ked committed Aug 20, 2012
Showing with 8 additions and 5 deletions.
  1. +4 −2 lib/nc.rb
  2. +4 −3 spec/nc_spec.rb
View
@@ -7,10 +7,12 @@ def dump_summary(duration, example_count, failure_count, pending_count)
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 #{failure_count} failed example#{failure_count == 1 ? nil : 's'}"
+ "\u26D4 #{name}: #{failure_count} failed example#{failure_count == 1 ? nil : 's'}"
else
- "\u2705 Success"
+ "\u2705 #{name}: Success"
end
say title, body.join("\n")
View
@@ -8,6 +8,7 @@
describe Nc do
let(:formatter) { Nc.new(StringIO.new) }
+ let(:current_dir) { File.basename(File.expand_path '.') }
# emoji
let(:success) { "\u2705" }
@@ -16,7 +17,7 @@
it 'returns the summary' do
TerminalNotifier.should_receive(:notify).with(
"Finished in 0.0001 seconds\n3 examples, 1 failure, 1 pending",
- :title => "#{failure} 1 failed example"
+ :title => "#{failure} #{current_dir}: 1 failed example"
)
formatter.dump_summary(0.0001, 3, 1, 1)
@@ -25,7 +26,7 @@
it 'returns a failing notification' do
TerminalNotifier.should_receive(:notify).with(
"Finished in 0.0001 seconds\n1 example, 1 failure",
- :title => "#{failure} 1 failed example"
+ :title => "#{failure} #{current_dir}: 1 failed example"
)
formatter.dump_summary(0.0001, 1, 1, 0)
@@ -34,7 +35,7 @@
it 'returns a success notification' do
TerminalNotifier.should_receive(:notify).with(
"Finished in 0.0001 seconds\n1 example, 0 failures",
- :title => "#{success} Success"
+ :title => "#{success} #{current_dir}: Success"
)
formatter.dump_summary(0.0001, 1, 0, 0)

0 comments on commit a03c437

Please sign in to comment.