Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
34bffb46
Commit
34bffb46
authored
Nov 20, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SpecHelper] Improved bacon support.
parent
da069bcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
9 deletions
+77
-9
bacon.rb
spec/spec_helper/bacon.rb
+77
-9
No files found.
spec/spec_helper/bacon.rb
View file @
34bffb46
...
@@ -3,10 +3,29 @@ module Bacon
...
@@ -3,10 +3,29 @@ module Bacon
@needs_first_put
=
true
@needs_first_put
=
true
module
ColorOutput
def
self
.
color
(
color
,
string
)
# Graciously yanked from https://github.com/zen-cms/Zen-Core and subsequently modified
case
color
# MIT License
when
:red
# Thanks, YorickPeterse! #:nodoc:
"
\e
[31m
#{
string
}
\e
[0m"
when
:green
"
\e
[32m
#{
string
}
\e
[0m"
when
:yellow
"
\e
[33m
#{
string
}
\e
[0m"
else
# Support for Conque
"
\e
[0m
#{
string
}
\e
[0m"
end
end
#---------------------------------------------------------------------------#
# Overrides the SpecDoxzRtput to provide colored output by default
#
# Based on https://github.com/zen-cms/Zen-Core and subsequently modified
# which is available under the MIT License. Thanks YorickPeterse!
#
module
SpecDoxOutput
def
handle_specification
(
name
)
def
handle_specification
(
name
)
if
@needs_first_put
if
@needs_first_put
@needs_first_put
=
false
@needs_first_put
=
false
...
@@ -27,18 +46,20 @@ module Bacon
...
@@ -27,18 +46,20 @@ module Bacon
error
=
yield
error
=
yield
if
!
error
.
empty?
if
!
error
.
empty?
puts
"
#{
spaces
}
\e
[31m-
#{
description
}
[FAILED]
\e
[0m"
puts
Bacon
.
color
(
:red
,
"
#{
spaces
}
-
#{
description
}
[FAILED]"
)
elsif
disabled
elsif
disabled
puts
"
#{
spaces
}
\e
[33m-
#{
description
}
[DISABLED]
\e
[0m"
puts
Bacon
.
color
(
:yellow
,
"
#{
spaces
}
-
#{
description
}
[DISABLED]"
)
else
else
puts
"
#{
spaces
}
\e
[32m-
#{
description
}
\e
[0m"
puts
Bacon
.
color
(
:green
,
"
#{
spaces
}
-
#{
description
}
"
)
end
end
end
end
#:nodoc:
#:nodoc:
def
handle_summary
def
handle_summary
print
ErrorLog
if
Backtraces
print
ErrorLog
if
Backtraces
puts
"
\e
[33m
#{
Counter
[
:disabled
]
}
disabled specifications
\n\e
[0m"
unless
Counter
[
:disabled
].
zero?
unless
Counter
[
:disabled
].
zero?
puts
Bacon
.
color
(
:yellow
,
"
#{
Counter
[
:disabled
]
}
disabled specifications
\n
"
)
end
puts
"%d specifications (%d requirements), %d failures, %d errors"
%
puts
"%d specifications (%d requirements), %d failures, %d errors"
%
Counter
.
values_at
(
:specifications
,
:requirements
,
:failed
,
:errors
)
Counter
.
values_at
(
:specifications
,
:requirements
,
:failed
,
:errors
)
end
end
...
@@ -48,7 +69,48 @@ module Bacon
...
@@ -48,7 +69,48 @@ module Bacon
return
' '
*
@specs_depth
return
' '
*
@specs_depth
end
end
end
end
extend
ColorOutput
#---------------------------------------------------------------------------#
# Overrides the TestUnitOutput to provide colored result output.
#
module
TestUnitOutput
def
handle_requirement
(
description
,
disabled
=
false
)
error
=
yield
if
!
error
.
empty?
m
=
error
[
0
..
0
]
c
=
(
m
==
"E"
?
:
red
:
:yellow
)
unless
@first_error
print
Bacon
.
color
(
c
,
m
)
@first_error
=
true
elsif
disabled
print
"D"
else
print
Bacon
.
color
(
nil
,
'.'
)
end
end
def
handle_summary
first_error
=
''
error_count
=
0
ErrorLog
.
lines
.
each
do
|
s
|
error_count
+=
1
if
s
.
include?
(
'Error:'
)
first_error
<<
s
if
error_count
<=
1
end
puts
"
\n
#{
first_error
}
"
if
Backtraces
unless
Counter
[
:disabled
].
zero?
puts
Bacon
.
color
(
:yellow
,
"
#{
Counter
[
:disabled
]
}
disabled specifications"
)
end
result
=
"%d specifications (%d requirements), %d failures, %d errors"
%
Counter
.
values_at
(
:specifications
,
:requirements
,
:failed
,
:errors
)
if
Counter
[
:failed
].
zero?
puts
Bacon
.
color
(
:green
,
result
)
else
puts
Bacon
.
color
(
:red
,
result
)
end
end
end
#---------------------------------------------------------------------------#
module
FilterBacktraces
module
FilterBacktraces
def
handle_summary
def
handle_summary
...
@@ -58,6 +120,9 @@ module Bacon
...
@@ -58,6 +120,9 @@ module Bacon
super
super
end
end
end
end
#---------------------------------------------------------------------------#
extend
FilterBacktraces
extend
FilterBacktraces
class
Context
class
Context
...
@@ -67,3 +132,6 @@ module Bacon
...
@@ -67,3 +132,6 @@ module Bacon
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment