holla 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +60 -0
- data/Rakefile +6 -0
- data/holla.gemspec +25 -0
- data/lib/holla.rb +65 -0
- data/lib/version.rb +1 -0
- data/spec/lib/holla_spec.rb +85 -0
- data/spec/spec_helper.rb +1 -0
- metadata +116 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
holla
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p392
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Brent Ertz
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# Holla
|
2
|
+
|
3
|
+
A talking [RSpec](http://rspec.info/) formatter that speaks test results aloud.
|
4
|
+
|
5
|
+
Internally, the speaking is performed using the Mac OSX [say](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/say.1.html) command, and as such will only work on a system where that command is available. If the system does not support the `say` command, standard RSpec output will still be displayed.
|
6
|
+
|
7
|
+
While Holla is capable of speaking individual example results, this behavior greatly lengthens the duration of test runs and thus the default behavior is to only speak the summary results.
|
8
|
+
|
9
|
+
Messages and voices are configurable too, see below for details.
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
gem 'holla'
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install holla
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
Run your specs using the following syntax:
|
28
|
+
|
29
|
+
rspec --format Holla --color spec
|
30
|
+
|
31
|
+
Or if you would like to make Holla your default RSpec formatter, create a `.rspec` file in your project root directory with the following contents:
|
32
|
+
|
33
|
+
--format Holla
|
34
|
+
--color
|
35
|
+
|
36
|
+
## Options
|
37
|
+
|
38
|
+
You may further customize the voices, messages, and enable/disable the summary only mode. One might do this for example, in a Rails initializer _(config/initializers/holla.rb)_ such as the following.
|
39
|
+
|
40
|
+
require 'holla'
|
41
|
+
|
42
|
+
Holla.voices = %w[Albert Alex Fred Ralph]
|
43
|
+
Holla.emcee = {
|
44
|
+
voice: 'Zarvox',
|
45
|
+
rate: 150
|
46
|
+
}
|
47
|
+
Holla.messages = {
|
48
|
+
positive: %w[yay! woohoo!],
|
49
|
+
negative: %w[boooo! sad\ panda],
|
50
|
+
indifferent: %w[meh whatever]
|
51
|
+
}
|
52
|
+
Holla.summary_only = false
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
1. Fork it
|
57
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
58
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
59
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
60
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/holla.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "holla"
|
8
|
+
spec.version = VERSION
|
9
|
+
spec.authors = ["Brent Ertz"]
|
10
|
+
spec.email = ["brent.ertz@gmail.com"]
|
11
|
+
spec.description = %q{A talking RSpec formatter}
|
12
|
+
spec.summary = %q{An RSpec formatter that speaks test results aloud.}
|
13
|
+
spec.homepage = "http://github.com/brentertz/holla"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rspec", "~> 2.0"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
data/lib/holla.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require "version"
|
2
|
+
require "rspec/core/formatters/progress_formatter"
|
3
|
+
|
4
|
+
class Holla < RSpec::Core::Formatters::ProgressFormatter
|
5
|
+
class << self
|
6
|
+
attr_accessor :voices, :emcee, :messages, :summary_only
|
7
|
+
end
|
8
|
+
|
9
|
+
@voices = %w[Agnes Albert Alex Bad\ News Bahh Bells Boing Bruce Bubbles Cellos
|
10
|
+
Deranged Fred Good\ News Hysterical Junior Kathy Pipe\ Organ
|
11
|
+
Princess Ralph Trinoids Vicki Victoria Whisper Zarvox]
|
12
|
+
|
13
|
+
@emcee = {
|
14
|
+
voice: 'Zarvox',
|
15
|
+
rate: 180
|
16
|
+
}
|
17
|
+
|
18
|
+
@messages = {
|
19
|
+
positive: %w[Yes! Dude! Sweet! Nice! Pretty\ much\ the\ best! Yo\ Dawg!],
|
20
|
+
negative: %w[No! Dang! Darn! Damn! Fail! Herp\ Derp! Sad\ Panda!],
|
21
|
+
indifferent: %w[Meh! Whatever!]
|
22
|
+
}
|
23
|
+
|
24
|
+
@summary_only = true
|
25
|
+
|
26
|
+
def start(example_count)
|
27
|
+
super
|
28
|
+
say 'Here we go!', Holla.emcee[:voice], Holla.emcee[:rate] unless summary_only?
|
29
|
+
end
|
30
|
+
|
31
|
+
def dump_summary(duration, example_count, failure_count, pending_count)
|
32
|
+
super
|
33
|
+
say "#{example_count} examples were run in #{duration.round 1} seconds. #{failure_count} failed and #{pending_count} were pending.", Holla.emcee[:voice], Holla.emcee[:rate]
|
34
|
+
end
|
35
|
+
|
36
|
+
def example_passed(example)
|
37
|
+
super
|
38
|
+
say Holla.messages[:positive].sample unless summary_only?
|
39
|
+
end
|
40
|
+
|
41
|
+
def example_failed(example)
|
42
|
+
super
|
43
|
+
say Holla.messages[:negative].sample unless summary_only?
|
44
|
+
end
|
45
|
+
|
46
|
+
def example_pending(example)
|
47
|
+
super example
|
48
|
+
say Holla.messages[:indifferent].sample unless summary_only?
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def say(message, voice = Holla.voices.sample, rate = Random.new.rand(150..500))
|
54
|
+
system("say #{message} -v #{voice} -r #{rate}") if can_speak?
|
55
|
+
end
|
56
|
+
|
57
|
+
def can_speak?
|
58
|
+
@can_speak ||= system('which say > /dev/null')
|
59
|
+
end
|
60
|
+
|
61
|
+
def summary_only?
|
62
|
+
Holla.summary_only
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
data/lib/version.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = '0.0.1'
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
describe Holla do
|
5
|
+
let(:output) { StringIO.new }
|
6
|
+
let(:formatter) { Holla.new(@output) }
|
7
|
+
let(:example) { RSpec::Core::ExampleGroup.describe.example }
|
8
|
+
|
9
|
+
describe "start" do
|
10
|
+
context "full messages" do
|
11
|
+
it "should say something" do
|
12
|
+
formatter.should_receive :say
|
13
|
+
formatter.start 1
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
context "summary only" do
|
18
|
+
before { formatter.class.summary_only = true }
|
19
|
+
after { formatter.class.summary_only = false }
|
20
|
+
|
21
|
+
it "should not say anything" do
|
22
|
+
formatter.should_not_receive :say
|
23
|
+
formatter.start 1
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "pass, pending, failed" do
|
29
|
+
context "full messages" do
|
30
|
+
context "example_passed" do
|
31
|
+
it "should say something positive" do
|
32
|
+
formatter.should_receive(:say) { |arg| Holla.messages[:positive].should include(arg) }
|
33
|
+
formatter.example_passed example
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "example_pending" do
|
38
|
+
it "should say something indifferent" do
|
39
|
+
formatter.should_receive(:say) { |arg| Holla.messages[:indifferent].should include(arg) }
|
40
|
+
formatter.example_pending example
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "example_failed" do
|
45
|
+
it "should say something negative" do
|
46
|
+
formatter.should_receive(:say) { |arg| Holla.messages[:negative].should include(arg) }
|
47
|
+
formatter.example_failed example
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "summary only" do
|
53
|
+
before { formatter.class.summary_only = true }
|
54
|
+
after { formatter.class.summary_only = false }
|
55
|
+
|
56
|
+
context "example_passed" do
|
57
|
+
it "should not say anything" do
|
58
|
+
formatter.should_not_receive :say
|
59
|
+
formatter.example_passed example
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "example_pending" do
|
64
|
+
it "should not say anything" do
|
65
|
+
formatter.should_not_receive :say
|
66
|
+
formatter.example_pending example
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
context "example_failed" do
|
71
|
+
it "should not say anything" do
|
72
|
+
formatter.should_not_receive :say
|
73
|
+
formatter.example_failed example
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "dump_summary" do
|
80
|
+
it "should speak the summary results" do
|
81
|
+
formatter.should_receive(:say)
|
82
|
+
formatter.dump_summary 5, 0, 0, 0
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'holla'
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: holla
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brent Ertz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rspec
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: bundler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '1.3'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '1.3'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: A talking RSpec formatter
|
63
|
+
email:
|
64
|
+
- brent.ertz@gmail.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- .rspec
|
71
|
+
- .ruby-gemset
|
72
|
+
- .ruby-version
|
73
|
+
- CHANGELOG.md
|
74
|
+
- Gemfile
|
75
|
+
- LICENSE.txt
|
76
|
+
- README.md
|
77
|
+
- Rakefile
|
78
|
+
- holla.gemspec
|
79
|
+
- lib/holla.rb
|
80
|
+
- lib/version.rb
|
81
|
+
- spec/lib/holla_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
homepage: http://github.com/brentertz/holla
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options: []
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
segments:
|
97
|
+
- 0
|
98
|
+
hash: -329042481617276976
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
segments:
|
106
|
+
- 0
|
107
|
+
hash: -329042481617276976
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 1.8.25
|
111
|
+
signing_key:
|
112
|
+
specification_version: 3
|
113
|
+
summary: An RSpec formatter that speaks test results aloud.
|
114
|
+
test_files:
|
115
|
+
- spec/lib/holla_spec.rb
|
116
|
+
- spec/spec_helper.rb
|