ghrunit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +11 -0
- data/Gemfile.lock +26 -0
- data/LICENSE.txt +20 -0
- data/README.mdown +54 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/ghrunit.gemspec +73 -0
- data/lib/ghrunit.rb +141 -0
- data/test/build_output.txt +48 -0
- data/test/helper.rb +27 -0
- data/test/test_ghrunit.rb +58 -0
- metadata +181 -0
data/.document
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
ansi (1.2.5)
|
5
|
+
git (1.2.5)
|
6
|
+
jeweler (1.5.2)
|
7
|
+
bundler (~> 1.0.0)
|
8
|
+
git (>= 1.2.5)
|
9
|
+
rake
|
10
|
+
mocha (0.9.12)
|
11
|
+
rake (0.9.2)
|
12
|
+
rcov (0.9.9)
|
13
|
+
shoulda (2.11.3)
|
14
|
+
turn (0.8.2)
|
15
|
+
ansi (>= 1.2.2)
|
16
|
+
|
17
|
+
PLATFORMS
|
18
|
+
ruby
|
19
|
+
|
20
|
+
DEPENDENCIES
|
21
|
+
bundler (~> 1.0.0)
|
22
|
+
jeweler (~> 1.5.2)
|
23
|
+
mocha
|
24
|
+
rcov
|
25
|
+
shoulda
|
26
|
+
turn
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 pjaspers
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.mdown
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# ghrunit
|
2
|
+
|
3
|
+
## What and why?
|
4
|
+
When using [GHUnit](http://gabriel.github.com/gh-unit/) from the command line to run your tests, it gets pretty verbose. So you're spending time combing through the results. Time you could have been spending on ready [hackernews](http://news.ycombinator.com/); so let's change that.
|
5
|
+
|
6
|
+
### What we're changing:
|
7
|
+
|
8
|
+
* Colored output
|
9
|
+
* Better grouping of tests
|
10
|
+
|
11
|
+
So this:
|
12
|
+
|
13
|
+
![Before](http://dl.dropbox.com/u/16204/ghrunit/before.png)
|
14
|
+
|
15
|
+
Becomes this:
|
16
|
+
|
17
|
+
![After](http://dl.dropbox.com/u/16204/ghrunit/after.png)
|
18
|
+
|
19
|
+
## How do I install it?
|
20
|
+
|
21
|
+
1. Be sure to read [this](http://gabriel.github.com/gh-unit/_command_line.html) for the command line build.
|
22
|
+
2. Install the gem (`gem install ghrunit`)
|
23
|
+
3. Create a `Rakefile` at the `.xcodeproj` level
|
24
|
+
4. Fill the `Rakefile` with:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'rake'
|
28
|
+
require 'ghrunit'
|
29
|
+
|
30
|
+
task :default => [:test]
|
31
|
+
|
32
|
+
desc "Cleans the build folder"
|
33
|
+
task :clean do
|
34
|
+
`rm -rf build/*`
|
35
|
+
end
|
36
|
+
|
37
|
+
desc "Tests the app from the command line"
|
38
|
+
task :test do
|
39
|
+
ENV['GHUNIT_CLI']="1"
|
40
|
+
GHRunit.new(:target => "tests")
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
## How do I use it?
|
45
|
+
|
46
|
+
Open your Terminal, navigate to the project folder and do `rake test`, this should show your tests, neatly organised and colored.
|
47
|
+
|
48
|
+
## Can I buy you a beer?
|
49
|
+
|
50
|
+
Yes.
|
51
|
+
|
52
|
+
Copyright (c) 2011 pjaspers. See LICENSE.txt for
|
53
|
+
further details.
|
54
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "ghrunit"
|
16
|
+
gem.homepage = "http://github.com/pjaspers/ghrunit"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{Better output for GHUnit command line builds}
|
19
|
+
gem.description = %Q{When using GHUnit from the command line to run your tests, it gets pretty verbose. So you're spending time combing through the results. Time you could have been spending on ready hackernews; so let's change that.}
|
20
|
+
gem.email = "piet@10to1.be"
|
21
|
+
gem.authors = ["pjaspers"]
|
22
|
+
gem.add_runtime_dependency 'turn'
|
23
|
+
end
|
24
|
+
Jeweler::RubygemsDotOrgTasks.new
|
25
|
+
|
26
|
+
require 'rake/testtask'
|
27
|
+
Rake::TestTask.new(:test) do |test|
|
28
|
+
test.libs << 'lib' << 'test'
|
29
|
+
test.pattern = 'test/**/test_*.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
|
33
|
+
require 'rcov/rcovtask'
|
34
|
+
Rcov::RcovTask.new do |test|
|
35
|
+
test.libs << 'test'
|
36
|
+
test.pattern = 'test/**/test_*.rb'
|
37
|
+
test.verbose = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "ghrunit #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/ghrunit.gemspec
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{ghrunit}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["pjaspers"]
|
12
|
+
s.date = %q{2011-06-21}
|
13
|
+
s.description = %q{When using GHUnit from the command line to run your tests, it gets pretty verbose. So you're spending time combing through the results. Time you could have been spending on ready hackernews; so let's change that.}
|
14
|
+
s.email = %q{piet@10to1.be}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.mdown"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.mdown",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"ghrunit.gemspec",
|
28
|
+
"lib/ghrunit.rb",
|
29
|
+
"test/build_output.txt",
|
30
|
+
"test/helper.rb",
|
31
|
+
"test/test_ghrunit.rb"
|
32
|
+
]
|
33
|
+
s.homepage = %q{http://github.com/pjaspers/ghrunit}
|
34
|
+
s.licenses = ["MIT"]
|
35
|
+
s.require_paths = ["lib"]
|
36
|
+
s.rubygems_version = %q{1.6.2}
|
37
|
+
s.summary = %q{Better output for GHUnit command line builds}
|
38
|
+
s.test_files = [
|
39
|
+
"test/helper.rb",
|
40
|
+
"test/test_ghrunit.rb"
|
41
|
+
]
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 3
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<turn>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
50
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
51
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
52
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
53
|
+
s.add_runtime_dependency(%q<turn>, [">= 0"])
|
54
|
+
else
|
55
|
+
s.add_dependency(%q<turn>, [">= 0"])
|
56
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
58
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
59
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
60
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
61
|
+
s.add_dependency(%q<turn>, [">= 0"])
|
62
|
+
end
|
63
|
+
else
|
64
|
+
s.add_dependency(%q<turn>, [">= 0"])
|
65
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
66
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
67
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
68
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
69
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
70
|
+
s.add_dependency(%q<turn>, [">= 0"])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
data/lib/ghrunit.rb
ADDED
@@ -0,0 +1,141 @@
|
|
1
|
+
require "stringio"
|
2
|
+
|
3
|
+
# In the future I'd want to try to make this move
|
4
|
+
# into [Turn](https://github.com/TwP/turn) itself.
|
5
|
+
#
|
6
|
+
# For now, just using some internals of `Turn`.
|
7
|
+
begin
|
8
|
+
# Used to colorize stuff
|
9
|
+
require "turn/colorize"
|
10
|
+
# Used for the tabto stuff
|
11
|
+
require "turn/core_ext"
|
12
|
+
rescue LoadError
|
13
|
+
begin
|
14
|
+
require 'rubygems'
|
15
|
+
# Used to colorize stuff
|
16
|
+
require "turn/colorize"
|
17
|
+
# Used for the tabto stuff
|
18
|
+
require "turn/core_ext"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class GHRunit
|
23
|
+
include Turn::Colorize
|
24
|
+
|
25
|
+
# Can be initialized with an Xcode `target` and a
|
26
|
+
# specified `Configuration`.
|
27
|
+
#
|
28
|
+
# GHRunit.new(:target => "Tests")
|
29
|
+
#
|
30
|
+
# Will start off a test build and run it.
|
31
|
+
def initialize(options = {})
|
32
|
+
options = default_options.merge(options)
|
33
|
+
@target = options[:target]
|
34
|
+
@configuration = options[:configuration]
|
35
|
+
|
36
|
+
start_suite!
|
37
|
+
end
|
38
|
+
|
39
|
+
# Will store all `stdout`-output
|
40
|
+
def buffer
|
41
|
+
@buffer ||= StringIO.new
|
42
|
+
end
|
43
|
+
|
44
|
+
# Not being used for now.
|
45
|
+
def error
|
46
|
+
@error ||= StringIO.new
|
47
|
+
end
|
48
|
+
|
49
|
+
def default_options
|
50
|
+
{:target => "tests", :configuration => "Debug"}
|
51
|
+
end
|
52
|
+
|
53
|
+
# The `Xcode` command line build argument.
|
54
|
+
def xcode_command_line_command
|
55
|
+
"xcodebuild -target #{@target} -configuration #{@configuration} -sdk iphonesimulator build"
|
56
|
+
end
|
57
|
+
|
58
|
+
# Runs the actual build
|
59
|
+
def run_build!
|
60
|
+
log %x{#{xcode_command_line_command}}
|
61
|
+
end
|
62
|
+
|
63
|
+
# This function does all the work.
|
64
|
+
def start_suite!
|
65
|
+
# Redirect output to ourselves
|
66
|
+
$stdout = buffer
|
67
|
+
$stderr = error
|
68
|
+
|
69
|
+
# PREPARING THE BUILD!
|
70
|
+
run_build!
|
71
|
+
|
72
|
+
# Giving back output
|
73
|
+
$stdout = STDOUT
|
74
|
+
buffer.rewind
|
75
|
+
|
76
|
+
# Parsing and outputting
|
77
|
+
until buffer.eof?
|
78
|
+
parse_line(buffer.readline)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# This parses the actual the output, we're using some basic
|
83
|
+
# regex matching, so pretty brittle at the moment.
|
84
|
+
def parse_line(line)
|
85
|
+
case line
|
86
|
+
when ''
|
87
|
+
# Skip blank lines
|
88
|
+
when /Test Suite '([a-zA-Z ]*)' started./
|
89
|
+
log_suite($1)
|
90
|
+
when /^Starting ([a-zA-Z]*)\/([a-zA-Z]*)/
|
91
|
+
log_test($1, $2)
|
92
|
+
when /^\s(OK|FAIL)\s\((.+)\)/
|
93
|
+
log_test_response($1, $2)
|
94
|
+
when /Test Suite '([a-zA-Z ]*)' finished./
|
95
|
+
# Another hook, but for now skipping
|
96
|
+
when /^(Executed(.?)+)$/
|
97
|
+
log_summary($1)
|
98
|
+
else
|
99
|
+
# do nothing
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# ## Log methods
|
104
|
+
|
105
|
+
def log_suite(name)
|
106
|
+
log "Starting for #{name}..."
|
107
|
+
end
|
108
|
+
|
109
|
+
def log_test(document, method)
|
110
|
+
if document != @document
|
111
|
+
log Turn::Colorize.bold("#{document}").tabto(2)
|
112
|
+
end
|
113
|
+
|
114
|
+
@document = document
|
115
|
+
@test_method = method
|
116
|
+
end
|
117
|
+
|
118
|
+
def log_test_response(response, time)
|
119
|
+
colorized = Turn::Colorize.red(response)
|
120
|
+
colorized = Turn::Colorize.green(response) if response == "OK"
|
121
|
+
|
122
|
+
method = @test_method.tabto(4) if @test_method
|
123
|
+
log "#{method} #{colorized} (#{time})"
|
124
|
+
end
|
125
|
+
|
126
|
+
def log_summary(summary)
|
127
|
+
log "\n"
|
128
|
+
if /(\d) failures/.match(summary)[1] == "0"
|
129
|
+
summary.gsub!(/(\d failures?)/, Turn::Colorize.green('\1'))
|
130
|
+
else
|
131
|
+
summary.gsub!(/(\d failures?)/, Turn::Colorize.red('\1'))
|
132
|
+
end
|
133
|
+
log summary
|
134
|
+
end
|
135
|
+
|
136
|
+
# A very thin wrapper around `log`, mainly added so we
|
137
|
+
# can test more easily.
|
138
|
+
def log(message)
|
139
|
+
puts message
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
PhaseScriptExecution "Run Script" build/Tin.build/Debug-iphonesimulator/tests.build/Script-055E1A3B13A638DB00C7D258.sh
|
2
|
+
cd /Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin
|
3
|
+
/bin/sh -c /Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Tin.build/Debug-iphonesimulator/tests.build/Script-055E1A3B13A638DB00C7D258.sh
|
4
|
+
Running: "/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests" -RegisterForSystemEvents
|
5
|
+
Test Suite 'Tests' started.
|
6
|
+
|
7
|
+
Starting TestOne/firstTest
|
8
|
+
Crap between the lines, here, should not affect the parser.
|
9
|
+
OK (0.000s)
|
10
|
+
|
11
|
+
Starting TestOne/lastTest
|
12
|
+
Not even if they're multiline
|
13
|
+
crap
|
14
|
+
a
|
15
|
+
hola
|
16
|
+
OK (0.000s)
|
17
|
+
|
18
|
+
Starting TestTwo/testTwoFail
|
19
|
+
2011-06-20 22:35:16.179 tests[38613:903]
|
20
|
+
Name: GHTestFailureException
|
21
|
+
File: ~/development/objc/TouchPoint/TouchPoint/vendor/Tin/tests/TinUtilityTest.m
|
22
|
+
Line: 57
|
23
|
+
Reason: Type mismatch --
|
24
|
+
|
25
|
+
#0 0x113a58c __exceptionPreprocess() (/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation)
|
26
|
+
#1 0x128e313 objc_exception_throw() (/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/libobjc.A.dylib)
|
27
|
+
#2 0x113a4e1 +[NSException raise] (/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation)
|
28
|
+
#3 0x04456b +[TinUtilityTest testTimeOutInSeconds] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
29
|
+
#4 0x057806 +[GHTesting runTestWithTarget:selector:exception:interval:reraiseExceptions:] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
30
|
+
#5 0x053b2a +[GHTest run:] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
31
|
+
#6 0x055735 +[GHTestGroup _run:] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
32
|
+
#7 0x055735 +[GHTestGroup _run:] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
33
|
+
#8 0x0589a7 +[GHTestRunner runTests] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
34
|
+
#9 0x058a16 +[GHTestRunner run] (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
35
|
+
#10 0x009457 main() (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
36
|
+
#11 0x006f51 start() (/Users/junkiesxl/development/objc/TouchPoint/TouchPoint/vendor/Tin/build/Debug-iphonesimulator/tests.app/tests)
|
37
|
+
FAIL (0.000s)
|
38
|
+
|
39
|
+
Starting TestTwo/testTwoOK
|
40
|
+
OK (0.000s)
|
41
|
+
|
42
|
+
Test Suite 'Tests' finished.
|
43
|
+
Executed 2 of 2 tests, with 1 failures in 4.535 seconds (0 disabled).
|
44
|
+
|
45
|
+
Failed tests:
|
46
|
+
TinUtilityTest/testTimeOutInSeconds
|
47
|
+
|
48
|
+
Command /bin/sh failed with exit code 1
|
data/test/helper.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'test/unit'
|
11
|
+
require 'shoulda'
|
12
|
+
require 'mocha'
|
13
|
+
|
14
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
|
+
require 'ghrunit'
|
17
|
+
|
18
|
+
class Test::Unit::TestCase
|
19
|
+
|
20
|
+
def any_ghrunit
|
21
|
+
GHRunit.any_instance
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_output_file
|
25
|
+
File.new(File.join(File.dirname(__FILE__), "build_output.txt"))
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestGhrunit < Test::Unit::TestCase
|
4
|
+
|
5
|
+
context "parsing test file" do
|
6
|
+
setup do
|
7
|
+
any_ghrunit.stubs(:buffer).returns(test_output_file)
|
8
|
+
# Not building anything
|
9
|
+
any_ghrunit.stubs(:run_build!)
|
10
|
+
# Not logging anything
|
11
|
+
any_ghrunit.stubs(:log)
|
12
|
+
end
|
13
|
+
|
14
|
+
should "log beginning of suite" do
|
15
|
+
any_ghrunit.expects(:log_suite).with("Tests")
|
16
|
+
GHRunit.new
|
17
|
+
end
|
18
|
+
|
19
|
+
should "log all test files and methods" do
|
20
|
+
any_ghrunit.expects(:log_test).with("TestOne", "firstTest")
|
21
|
+
any_ghrunit.expects(:log_test).with("TestOne", "lastTest")
|
22
|
+
any_ghrunit.expects(:log_test).with("TestTwo", "testTwoFail")
|
23
|
+
any_ghrunit.expects(:log_test).with("TestTwo", "testTwoOK")
|
24
|
+
GHRunit.new
|
25
|
+
end
|
26
|
+
|
27
|
+
should "log all test responses" do
|
28
|
+
any_ghrunit.expects(:log_test_response).with("OK", "0.000s").at_least(3)
|
29
|
+
any_ghrunit.expects(:log_test_response).with("FAIL", "0.000s").at_least(1)
|
30
|
+
GHRunit.new
|
31
|
+
end
|
32
|
+
|
33
|
+
should "log the summary" do
|
34
|
+
any_ghrunit.expects(:log_summary).with("Executed 2 of 2 tests, with 1 failures in 4.535 seconds (0 disabled).")
|
35
|
+
GHRunit.new
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "parsing summary" do
|
40
|
+
setup do
|
41
|
+
any_ghrunit.stubs(:start_suite!)
|
42
|
+
# Not logging anything
|
43
|
+
any_ghrunit.stubs(:log)
|
44
|
+
end
|
45
|
+
|
46
|
+
# should "make summary green of 0 failures" do
|
47
|
+
# Turn::Colorize.expects(:color_green)
|
48
|
+
# ghrunit = GHRunit.new
|
49
|
+
# ghrunit.log_summary("0 failures")
|
50
|
+
# end
|
51
|
+
|
52
|
+
# should "make summary red with more than 0 failures" do
|
53
|
+
# Turn::Colorize.expects(:red)
|
54
|
+
# ghrunit = GHRunit.new
|
55
|
+
# ghrunit.log_summary("8 failures")
|
56
|
+
# end
|
57
|
+
end
|
58
|
+
end
|
metadata
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ghrunit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- pjaspers
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-21 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
23
|
+
none: false
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
hash: 3
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
name: turn
|
32
|
+
version_requirements: *id001
|
33
|
+
prerelease: false
|
34
|
+
type: :runtime
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 3
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
version: "0"
|
45
|
+
name: shoulda
|
46
|
+
version_requirements: *id002
|
47
|
+
prerelease: false
|
48
|
+
type: :development
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
58
|
+
version: "0"
|
59
|
+
name: mocha
|
60
|
+
version_requirements: *id003
|
61
|
+
prerelease: false
|
62
|
+
type: :development
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
hash: 23
|
70
|
+
segments:
|
71
|
+
- 1
|
72
|
+
- 0
|
73
|
+
- 0
|
74
|
+
version: 1.0.0
|
75
|
+
name: bundler
|
76
|
+
version_requirements: *id004
|
77
|
+
prerelease: false
|
78
|
+
type: :development
|
79
|
+
- !ruby/object:Gem::Dependency
|
80
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
hash: 7
|
86
|
+
segments:
|
87
|
+
- 1
|
88
|
+
- 5
|
89
|
+
- 2
|
90
|
+
version: 1.5.2
|
91
|
+
name: jeweler
|
92
|
+
version_requirements: *id005
|
93
|
+
prerelease: false
|
94
|
+
type: :development
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
hash: 3
|
102
|
+
segments:
|
103
|
+
- 0
|
104
|
+
version: "0"
|
105
|
+
name: rcov
|
106
|
+
version_requirements: *id006
|
107
|
+
prerelease: false
|
108
|
+
type: :development
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
111
|
+
none: false
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
hash: 3
|
116
|
+
segments:
|
117
|
+
- 0
|
118
|
+
version: "0"
|
119
|
+
name: turn
|
120
|
+
version_requirements: *id007
|
121
|
+
prerelease: false
|
122
|
+
type: :runtime
|
123
|
+
description: When using GHUnit from the command line to run your tests, it gets pretty verbose. So you're spending time combing through the results. Time you could have been spending on ready hackernews; so let's change that.
|
124
|
+
email: piet@10to1.be
|
125
|
+
executables: []
|
126
|
+
|
127
|
+
extensions: []
|
128
|
+
|
129
|
+
extra_rdoc_files:
|
130
|
+
- LICENSE.txt
|
131
|
+
- README.mdown
|
132
|
+
files:
|
133
|
+
- .document
|
134
|
+
- Gemfile
|
135
|
+
- Gemfile.lock
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.mdown
|
138
|
+
- Rakefile
|
139
|
+
- VERSION
|
140
|
+
- ghrunit.gemspec
|
141
|
+
- lib/ghrunit.rb
|
142
|
+
- test/build_output.txt
|
143
|
+
- test/helper.rb
|
144
|
+
- test/test_ghrunit.rb
|
145
|
+
has_rdoc: true
|
146
|
+
homepage: http://github.com/pjaspers/ghrunit
|
147
|
+
licenses:
|
148
|
+
- MIT
|
149
|
+
post_install_message:
|
150
|
+
rdoc_options: []
|
151
|
+
|
152
|
+
require_paths:
|
153
|
+
- lib
|
154
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
hash: 3
|
160
|
+
segments:
|
161
|
+
- 0
|
162
|
+
version: "0"
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ">="
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
hash: 3
|
169
|
+
segments:
|
170
|
+
- 0
|
171
|
+
version: "0"
|
172
|
+
requirements: []
|
173
|
+
|
174
|
+
rubyforge_project:
|
175
|
+
rubygems_version: 1.6.2
|
176
|
+
signing_key:
|
177
|
+
specification_version: 3
|
178
|
+
summary: Better output for GHUnit command line builds
|
179
|
+
test_files:
|
180
|
+
- test/helper.rb
|
181
|
+
- test/test_ghrunit.rb
|