rspec-nc 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +8 -0
- data/README.md +29 -2
- data/lib/nc.rb +13 -1
- data/rspec-nc.gemspec +2 -2
- data/spec/nc_spec.rb +29 -7
- metadata +11 -3
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -1,4 +1,31 @@
|
|
1
1
|
RSpec Notification Center
|
2
|
-
|
2
|
+
=========================
|
3
3
|
|
4
|
-
|
4
|
+
rspec-nc is an RSpec formatter for Mountain Lion's Notification Center.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
Installing rspec-nc is easy. Just put it in your Gemfile (`gem 'rspec-nc'`) and
|
10
|
+
run your specs like this from now on:
|
11
|
+
|
12
|
+
```
|
13
|
+
$ rspec --format=doc --format=Nc
|
14
|
+
```
|
15
|
+
|
16
|
+
You will want to specify another formatter as rspec-nc does not provide any
|
17
|
+
other output.
|
18
|
+
|
19
|
+
If you want to use rspec-nc as your default formatter, simply put this option
|
20
|
+
in your .rspec file:
|
21
|
+
|
22
|
+
```
|
23
|
+
--format Nc
|
24
|
+
```
|
25
|
+
|
26
|
+
Contributing
|
27
|
+
------------
|
28
|
+
|
29
|
+
Found an issue? Have a great idea? Want to help? Great! Create an issue issue
|
30
|
+
for it, or even better; fork the project and fix the problem yourself. Pull
|
31
|
+
requests are always welcome. :)
|
data/lib/nc.rb
CHANGED
@@ -3,7 +3,19 @@ require 'terminal-notifier'
|
|
3
3
|
|
4
4
|
class Nc < RSpec::Core::Formatters::BaseTextFormatter
|
5
5
|
def dump_summary(duration, example_count, failure_count, pending_count)
|
6
|
-
|
6
|
+
body = []
|
7
|
+
body << "Finished in #{format_duration duration}"
|
8
|
+
body << summary_line(example_count, failure_count, pending_count)
|
9
|
+
|
10
|
+
name = File.basename(File.expand_path '.')
|
11
|
+
|
12
|
+
title = if failure_count > 0
|
13
|
+
"\u26D4 #{name}: #{failure_count} failed example#{failure_count == 1 ? nil : 's'}"
|
14
|
+
else
|
15
|
+
"\u2705 #{name}: Success"
|
16
|
+
end
|
17
|
+
|
18
|
+
say title, body.join("\n")
|
7
19
|
end
|
8
20
|
|
9
21
|
def dump_pending; end
|
data/rspec-nc.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |gem|
|
3
3
|
gem.name = 'rspec-nc'
|
4
|
-
gem.version = '0.0.
|
4
|
+
gem.version = '0.0.2'
|
5
5
|
gem.authors = ['Odin Dutton']
|
6
6
|
gem.email = ['odindutton@gmail.com']
|
7
7
|
gem.description = 'https://github.com/twe4ked/rspec-nc'
|
8
|
-
gem.summary = "RSpec
|
8
|
+
gem.summary = "RSpec formatter for Mountain Lion's Notification Center"
|
9
9
|
gem.homepage = 'https://github.com/twe4ked/rspec-nc'
|
10
10
|
|
11
11
|
gem.add_dependency 'terminal-notifier', '~> 1.4.2'
|
data/spec/nc_spec.rb
CHANGED
@@ -6,16 +6,38 @@ RSpec.configure do |config|
|
|
6
6
|
config.formatter = 'Nc'
|
7
7
|
end
|
8
8
|
|
9
|
-
describe
|
10
|
-
|
11
|
-
|
9
|
+
describe Nc do
|
10
|
+
let(:formatter) { Nc.new(StringIO.new) }
|
11
|
+
let(:current_dir) { File.basename(File.expand_path '.') }
|
12
|
+
|
13
|
+
# emoji
|
14
|
+
let(:success) { "\u2705" }
|
15
|
+
let(:failure) { "\u26D4" }
|
16
|
+
|
17
|
+
it 'returns the summary' do
|
18
|
+
TerminalNotifier.should_receive(:notify).with(
|
19
|
+
"Finished in 0.0001 seconds\n3 examples, 1 failure, 1 pending",
|
20
|
+
:title => "#{failure} #{current_dir}: 1 failed example"
|
21
|
+
)
|
22
|
+
|
23
|
+
formatter.dump_summary(0.0001, 3, 1, 1)
|
12
24
|
end
|
13
25
|
|
14
|
-
it 'returns
|
15
|
-
|
26
|
+
it 'returns a failing notification' do
|
27
|
+
TerminalNotifier.should_receive(:notify).with(
|
28
|
+
"Finished in 0.0001 seconds\n1 example, 1 failure",
|
29
|
+
:title => "#{failure} #{current_dir}: 1 failed example"
|
30
|
+
)
|
31
|
+
|
32
|
+
formatter.dump_summary(0.0001, 1, 1, 0)
|
16
33
|
end
|
17
34
|
|
18
|
-
it 'returns
|
19
|
-
|
35
|
+
it 'returns a success notification' do
|
36
|
+
TerminalNotifier.should_receive(:notify).with(
|
37
|
+
"Finished in 0.0001 seconds\n1 example, 0 failures",
|
38
|
+
:title => "#{success} #{current_dir}: Success"
|
39
|
+
)
|
40
|
+
|
41
|
+
formatter.dump_summary(0.0001, 1, 0, 0)
|
20
42
|
end
|
21
43
|
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.
|
4
|
+
version: 0.0.2
|
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: 2012-08-
|
12
|
+
date: 2012-08-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: terminal-notifier
|
@@ -34,6 +34,8 @@ executables: []
|
|
34
34
|
extensions: []
|
35
35
|
extra_rdoc_files: []
|
36
36
|
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
37
39
|
- LICENSE
|
38
40
|
- README.md
|
39
41
|
- Rakefile
|
@@ -52,17 +54,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
52
54
|
- - ! '>='
|
53
55
|
- !ruby/object:Gem::Version
|
54
56
|
version: '0'
|
57
|
+
segments:
|
58
|
+
- 0
|
59
|
+
hash: 614248334397508871
|
55
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
61
|
none: false
|
57
62
|
requirements:
|
58
63
|
- - ! '>='
|
59
64
|
- !ruby/object:Gem::Version
|
60
65
|
version: '0'
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
hash: 614248334397508871
|
61
69
|
requirements: []
|
62
70
|
rubyforge_project:
|
63
71
|
rubygems_version: 1.8.23
|
64
72
|
signing_key:
|
65
73
|
specification_version: 3
|
66
|
-
summary: RSpec
|
74
|
+
summary: RSpec formatter for Mountain Lion's Notification Center
|
67
75
|
test_files:
|
68
76
|
- spec/nc_spec.rb
|