baretest-vows 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/LICENSE +19 -0
  2. data/README.md +18 -0
  3. data/lib/baretest/formatter/vows.rb +76 -0
  4. metadata +85 -0
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2010 Danny Tatom
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # baretest-vows
2
+
3
+ A sexier format for [baretest](http://github.com/apeiros/baretest)
4
+ inspired by [vows.js](http://github.com/cloudhead/vows).
5
+
6
+ ## Installation
7
+
8
+ # Depends on baretest v0.5.0.pre
9
+
10
+ gem install baretest-vows
11
+
12
+ ## Usage
13
+
14
+ ![BOOOOMMMMM!](http://i.imgur.com/4mvpH.png)
15
+
16
+ ## Copyright
17
+
18
+ Copyright (c) 2010 Danny Tatom. See LICENSE for details.
@@ -0,0 +1,76 @@
1
+ # encoding: utf-8
2
+
3
+ module BareTest
4
+ class Formatter
5
+ class Vows < Formatter
6
+ register 'baretest/formatter/vows'
7
+
8
+ Symbols = {
9
+ :success => '✓',
10
+ :skipped => '-',
11
+ :pending => '-',
12
+ :failure => '✗'
13
+ }
14
+
15
+ Labels = {
16
+ :success => "\e[1;32mOK\e[0m",
17
+ :pending => "\e[1;96mPending\e[0m",
18
+ :failure => "\e[1;31mBroken\e[0m",
19
+ }
20
+
21
+ Colors = {
22
+ :success => "\e[32m",
23
+ :skipped => "\e[30m",
24
+ :pending => "\e[36m",
25
+ :failure => "\e[31m",
26
+ :normal => "\e[0m"
27
+ }
28
+
29
+ def stylize status, string
30
+ Colors[status] + string + Colors[:normal]
31
+ end
32
+
33
+ def start_suite suite
34
+ defer do
35
+ if suite.description
36
+ puts indent(suite, -1) + suite.description
37
+ end
38
+ end
39
+ end
40
+
41
+ def end_test test, status, elapsed
42
+ apply_deferred
43
+
44
+ puts indent(test, -1) + Symbols[status.code] +
45
+ ' ' + stylize(status.code, test.description)
46
+
47
+ case status.code
48
+ when :pending, :skipped, :failure
49
+ puts indent(test) + '» ' + stylize(status.code, status.reason)
50
+ when :error
51
+ backtrace = backtrace(status).join("\n")
52
+
53
+ puts indent(test, +1) + '» ' + stylize(status.code, status.reason)
54
+ puts indent(test, +1) + '» ' + stylize(status.code, backtrace)
55
+ end
56
+ end
57
+
58
+ def end_all status_collection, elapsed
59
+ success, pending, skipped,
60
+ failure, error = *status_collection.values_at(:success,
61
+ :pending,
62
+ :skipped,
63
+ :failure,
64
+ :error)
65
+
66
+ puts
67
+ puts Symbols[status_collection.code] +
68
+ ' ' + Labels[status_collection.code] +
69
+ " » \e[1m#{success}\e[0m honored" +
70
+ " • \e[1m#{failure}\e[0m failed" +
71
+ " • \e[1m#{pending}\e[0m pending" +
72
+ " \e[30m(#{elapsed}s)\e[0m"
73
+ end
74
+ end
75
+ end
76
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: baretest-vows
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Danny Tatom
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-22 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: baretest
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 254075412
30
+ segments:
31
+ - 0
32
+ - 5
33
+ - 0
34
+ - pre
35
+ version: 0.5.0.pre
36
+ type: :development
37
+ version_requirements: *id001
38
+ description: A sexier format for baretest inspired by vows.js
39
+ email: dannytatom@gmail.com
40
+ executables: []
41
+
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - README.md
48
+ - LICENSE
49
+ - lib/baretest/formatter/vows.rb
50
+ has_rdoc: true
51
+ homepage: http://github.com/dannytatom/baretest-vows
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ hash: 3
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.7
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: A sexier format for baretest
84
+ test_files: []
85
+