shindo 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/shindo.rb +27 -17
- data/shindo.gemspec +2 -2
- metadata +3 -3
data/lib/shindo.rb
CHANGED
@@ -5,7 +5,7 @@ require 'gestalt'
|
|
5
5
|
module Shindo
|
6
6
|
|
7
7
|
unless const_defined?(:VERSION)
|
8
|
-
VERSION = '0.1.
|
8
|
+
VERSION = '0.1.3'
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.tests(description = nil, tags = [], &block)
|
@@ -47,7 +47,7 @@ module Shindo
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def tests(description, tags = [], &block)
|
50
|
-
return if @exit || Thread.current[:reload]
|
50
|
+
return self if @exit || Thread.current[:reload]
|
51
51
|
|
52
52
|
tags = [*tags]
|
53
53
|
@tag_stack.push(tags)
|
@@ -69,12 +69,7 @@ module Shindo
|
|
69
69
|
@formatador.display_line(description)
|
70
70
|
@formatador.indent { instance_eval(&block) }
|
71
71
|
rescue => error
|
72
|
-
|
73
|
-
unless error.backtrace.empty?
|
74
|
-
@formatador.indent do
|
75
|
-
@formatador.display_lines(error.backtrace.map {|line| "[red]#{line}[/]"})
|
76
|
-
end
|
77
|
-
end
|
72
|
+
display_error(error)
|
78
73
|
end
|
79
74
|
else
|
80
75
|
@description = description
|
@@ -126,20 +121,26 @@ module Shindo
|
|
126
121
|
after.call
|
127
122
|
end
|
128
123
|
rescue => error
|
129
|
-
|
124
|
+
success = false
|
125
|
+
value = error
|
130
126
|
end
|
131
127
|
if success
|
132
128
|
success(description)
|
133
129
|
else
|
134
130
|
failure(description)
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
131
|
+
case value
|
132
|
+
when Exception, Interrupt
|
133
|
+
display_error(value)
|
134
|
+
else
|
135
|
+
@message ||= [
|
136
|
+
"expected => #{expectation.inspect}",
|
137
|
+
"returned => #{value.inspect}"
|
138
|
+
]
|
139
|
+
@formatador.indent do
|
140
|
+
@formatador.display_lines([*@message].map {|message| "[red]#{message}[/]"})
|
141
|
+
end
|
142
|
+
@message = nil
|
141
143
|
end
|
142
|
-
@message = nil
|
143
144
|
if STDOUT.tty?
|
144
145
|
prompt(description, &block)
|
145
146
|
end
|
@@ -150,6 +151,15 @@ module Shindo
|
|
150
151
|
success
|
151
152
|
end
|
152
153
|
|
154
|
+
def display_error(error)
|
155
|
+
@formatador.display_line("[red]#{error.message} (#{error.class})[/]")
|
156
|
+
unless error.backtrace.empty?
|
157
|
+
@formatador.indent do
|
158
|
+
@formatador.display_lines(error.backtrace.map {|line| "[red]#{line}[/]"})
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
153
163
|
def failure(description, &block)
|
154
164
|
Thread.current[:totals][:failed] += 1
|
155
165
|
@formatador.display_line("[red]- #{description}[/]")
|
@@ -177,7 +187,7 @@ module Shindo
|
|
177
187
|
end
|
178
188
|
@formatador.display_line(value)
|
179
189
|
rescue => error
|
180
|
-
|
190
|
+
display_error(error)
|
181
191
|
end
|
182
192
|
when 'i', 'interactive', 'irb'
|
183
193
|
@formatador.display_line('Starting interactive session...')
|
data/shindo.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'shindo'
|
16
|
-
s.version = '0.1.
|
17
|
-
s.date = '2010-05-
|
16
|
+
s.version = '0.1.3'
|
17
|
+
s.date = '2010-05-24'
|
18
18
|
s.rubyforge_project = 'shindo'
|
19
19
|
|
20
20
|
## Make sure your summary is short. The description may be as long
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-05-
|
17
|
+
date: 2010-05-24 00:00:00 -07:00
|
18
18
|
default_executable: shindo
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|