rspec-nc 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
@@ -0,0 +1,15 @@
1
+ require 'nc'
2
+
3
+ class NcFirstFail < Nc
4
+ def example_failed(example)
5
+ if @failed_examples.size == 0
6
+ name = File.basename(File.expand_path '.')
7
+ say "\u26D4 #{name}: Failure", "#{example.metadata[:full_description]}\n#{example.exception}"
8
+ end
9
+ super
10
+ end
11
+
12
+ def dump_summary(duration, example_count, failure_count, pending_count)
13
+ super if failure_count == 0
14
+ end
15
+ end
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |gem|
3
3
  gem.name = 'rspec-nc'
4
- gem.version = '0.0.5'
4
+ gem.version = '0.0.6'
5
5
  gem.authors = ['Odin Dutton']
6
6
  gem.email = ['odindutton@gmail.com']
7
7
  gem.description = 'https://github.com/twe4ked/rspec-nc'
@@ -0,0 +1,32 @@
1
+ require 'nc_first_fail'
2
+
3
+ describe NcFirstFail do
4
+ let(:formatter) { NcFirstFail.new(StringIO.new) }
5
+ let(:current_dir) { File.basename(File.expand_path '.') }
6
+ let(:example) { double 'example' }
7
+ let(:example2) { double 'example2' }
8
+
9
+ let(:failure) { "\u26D4" }
10
+ let(:exception) { 'exception' }
11
+ let(:description) { 'description' }
12
+
13
+ before do
14
+ example.should_receive(:metadata).any_number_of_times.and_return({:full_description => description})
15
+ example.should_receive(:exception).any_number_of_times.and_return(exception)
16
+ end
17
+
18
+ it 'notifies the first failure only' do
19
+ TerminalNotifier.should_receive(:notify).with("#{description}\n#{exception}",
20
+ :title => "#{failure} #{current_dir}: Failure"
21
+ )
22
+
23
+ formatter.example_failed(example)
24
+ formatter.example_failed(example2)
25
+ end
26
+
27
+ it "doesn't notify in the end if there has been any failures" do
28
+ TerminalNotifier.should_not_receive(:notify)
29
+
30
+ formatter.dump_summary(0.0001, 2, 1, 0)
31
+ end
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-nc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-17 00:00:00.000000000 Z
12
+ date: 2013-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: terminal-notifier
@@ -57,8 +57,10 @@ files:
57
57
  - Rakefile
58
58
  - lib/nc.rb
59
59
  - lib/nc_fail.rb
60
+ - lib/nc_first_fail.rb
60
61
  - rspec-nc.gemspec
61
62
  - spec/nc_fail_spec.rb
63
+ - spec/nc_first_fail_spec.rb
62
64
  - spec/nc_spec.rb
63
65
  homepage: https://github.com/twe4ked/rspec-nc
64
66
  licenses: []
@@ -74,7 +76,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
76
  version: '0'
75
77
  segments:
76
78
  - 0
77
- hash: -2829950422095626050
79
+ hash: -2800251499294320553
78
80
  required_rubygems_version: !ruby/object:Gem::Requirement
79
81
  none: false
80
82
  requirements:
@@ -83,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  version: '0'
84
86
  segments:
85
87
  - 0
86
- hash: -2829950422095626050
88
+ hash: -2800251499294320553
87
89
  requirements: []
88
90
  rubyforge_project:
89
91
  rubygems_version: 1.8.23
@@ -92,4 +94,5 @@ specification_version: 3
92
94
  summary: RSpec formatter for Mountain Lion's Notification Center
93
95
  test_files:
94
96
  - spec/nc_fail_spec.rb
97
+ - spec/nc_first_fail_spec.rb
95
98
  - spec/nc_spec.rb