chuck-testar 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +36 -0
- data/chuck_testar.gemspec +24 -0
- data/lib/chuck_testar.rb +56 -0
- data/lib/notifications/growl.rb +7 -0
- data/spec/spec_helper.rb +24 -0
- metadata +80 -0
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Chuck testr RSpec formatter
|
2
|
+
|
3
|
+
The gem is a game changer... Nope! It's just **Chuck TestR - Chuck's Testa RSpec formatter**
|
4
|
+
|
5
|
+
## Requirements
|
6
|
+
|
7
|
+
It requires only `rspec` gem, obviously. It only works with OS X for now.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
If you are using bundler, add this to your `Gemfile`:
|
12
|
+
|
13
|
+
gem 'ChuckTestR'
|
14
|
+
|
15
|
+
Or install the gem manually with `gem install chuck_testr_formatter`.
|
16
|
+
|
17
|
+
## Usage
|
18
|
+
|
19
|
+
To start using the formatter you can either specify it in the rspec's command line options or add it to `.rspec` file:
|
20
|
+
|
21
|
+
- With `.rspec` file
|
22
|
+
|
23
|
+
Add this line to your `.rspec` file:
|
24
|
+
|
25
|
+
--format ChuckTestR
|
26
|
+
|
27
|
+
- With command line options
|
28
|
+
|
29
|
+
rspec spec/* --format ChuckTestR
|
30
|
+
|
31
|
+
### TODO
|
32
|
+
|
33
|
+
- Add license
|
34
|
+
- Add growl notifications
|
35
|
+
- Specs
|
36
|
+
- Support for Linux
|
@@ -0,0 +1,24 @@
|
|
1
|
+
lib = File.expand_path('../lib/', __FILE__)
|
2
|
+
$:.unshift lib unless $:.include?(lib)
|
3
|
+
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "chuck-testar"
|
8
|
+
s.version = '0.0.1'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Mariusz Lusiak"]
|
11
|
+
s.email = ["mariusz@applicake.com"]
|
12
|
+
s.homepage = "http://applicake.com"
|
13
|
+
s.summary = %q{Chuck Testar Formatter for RSpec}
|
14
|
+
s.description = %q{}
|
15
|
+
|
16
|
+
s.required_rubygems_version = ">= 1.3.6"
|
17
|
+
|
18
|
+
s.add_runtime_dependency 'rspec'
|
19
|
+
s.add_runtime_dependency 'growl_notify'
|
20
|
+
|
21
|
+
s.files = %w( README.md chuck_testar.gemspec ) + Dir["lib/**/*.rb"]
|
22
|
+
s.test_files = Dir["spec/**/*.rb"]
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
data/lib/chuck_testar.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'rspec/core/formatters/base_text_formatter'
|
2
|
+
require 'notifications/growl'
|
3
|
+
|
4
|
+
class ChuckTestar < RSpec::Core::Formatters::BaseTextFormatter
|
5
|
+
def icon(name)
|
6
|
+
File.join(File.dirname(__FILE__), '../assets', name)
|
7
|
+
end
|
8
|
+
|
9
|
+
def start(example_count)
|
10
|
+
super(example_count)
|
11
|
+
output.print green('Y')
|
12
|
+
end
|
13
|
+
|
14
|
+
def stop
|
15
|
+
output.print green('p')
|
16
|
+
output.print green("\n\nYour tests pass!\n")
|
17
|
+
GrowlNotify.normal({
|
18
|
+
:title => 'RSpec',
|
19
|
+
:description => 'Your tests pass',
|
20
|
+
:icon => icon('chuck-normal.png')
|
21
|
+
})
|
22
|
+
`say 'Your tests pass!'`
|
23
|
+
sleep(2)
|
24
|
+
if @failed_examples.length > 0
|
25
|
+
output.print magenta("\n\nNope! It's just Chuck Testa!")
|
26
|
+
GrowlNotify.high({
|
27
|
+
:title => 'RSpec',
|
28
|
+
:description => 'Nope! It\'s just Chuck Testa!',
|
29
|
+
:icon => icon('chuck-nope.png')
|
30
|
+
})
|
31
|
+
`say "Nope! It's just Chuck Testa!"`
|
32
|
+
sleep(1)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def example_passed(example)
|
37
|
+
super(example)
|
38
|
+
output.print green('e')
|
39
|
+
end
|
40
|
+
|
41
|
+
def example_pending(example)
|
42
|
+
super(example)
|
43
|
+
output.print green('e')
|
44
|
+
end
|
45
|
+
|
46
|
+
def example_failed(example)
|
47
|
+
super(example)
|
48
|
+
output.print green('e')
|
49
|
+
end
|
50
|
+
|
51
|
+
def start_dump
|
52
|
+
super()
|
53
|
+
output.puts
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require "growl_notify"
|
2
|
+
|
3
|
+
GrowlNotify.config do |config|
|
4
|
+
config.notifications = ["Chuck Testar"]
|
5
|
+
config.default_notifications = ["Chuck Testar"]
|
6
|
+
config.application_name = "Chuck Testar RSpec formatter" # this shoes up in the growl applications list in systems settings
|
7
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#require 'simplecov'
|
2
|
+
#SimpleCov.start
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spork'
|
6
|
+
|
7
|
+
Spork.prefork do
|
8
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
9
|
+
|
10
|
+
require 'rubygems'
|
11
|
+
require 'bundler'
|
12
|
+
Bundler.setup
|
13
|
+
require 'rspec'
|
14
|
+
Dir[File.join(File.expand_path('../', __FILE__), "support/**/*.rb")].each do |file|
|
15
|
+
require file
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'chuck_testr'
|
19
|
+
end
|
20
|
+
|
21
|
+
Spork.each_run do
|
22
|
+
|
23
|
+
end
|
24
|
+
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chuck-testar
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Mariusz Lusiak
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-10-27 00:00:00 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: "0"
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *id001
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: growl_notify
|
28
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *id002
|
37
|
+
description: ""
|
38
|
+
email:
|
39
|
+
- mariusz@applicake.com
|
40
|
+
executables: []
|
41
|
+
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- README.md
|
48
|
+
- chuck_testar.gemspec
|
49
|
+
- lib/chuck_testar.rb
|
50
|
+
- lib/notifications/growl.rb
|
51
|
+
- spec/spec_helper.rb
|
52
|
+
homepage: http://applicake.com
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: "0"
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.3.6
|
72
|
+
requirements: []
|
73
|
+
|
74
|
+
rubyforge_project:
|
75
|
+
rubygems_version: 1.8.5
|
76
|
+
signing_key:
|
77
|
+
specification_version: 3
|
78
|
+
summary: Chuck Testar Formatter for RSpec
|
79
|
+
test_files:
|
80
|
+
- spec/spec_helper.rb
|