Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gpt
large_projects
gitlabhq1
Commits
d2632480
Unverified
Commit
d2632480
authored
8 years ago
by
Rémy Coutable
Browse files
Options
Download
Email Patches
Plain Diff
Monkey-patch Knapsack to include context duration in reports for PG
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
e7b6f39f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
spec/spec_helper.rb
spec/spec_helper.rb
+34
-0
No files found.
spec/spec_helper.rb
View file @
d2632480
...
...
@@ -24,6 +24,40 @@ end
if
ENV
[
'CI'
]
&&
!
ENV
[
'NO_KNAPSACK'
]
require
'knapsack'
Knapsack
::
Adapters
::
RSpecAdapter
.
bind
if
ENV
[
'GITLAB_DATABASE'
]
==
'postgresql'
module
Knapsack
module
Adapters
class
RSpecAdapter
<
BaseAdapter
def
bind_time_tracker
::
RSpec
.
configure
do
|
config
|
config
.
before
(
:context
)
do
Knapsack
.
tracker
.
start_timer
end
config
.
before
(
:each
)
do
current_example_group
=
if
::
RSpec
.
respond_to?
(
:current_example
)
::
RSpec
.
current_example
.
metadata
[
:example_group
]
else
example
.
metadata
end
Knapsack
.
tracker
.
test_path
=
RSpecAdapter
.
test_path
(
current_example_group
)
end
config
.
after
(
:context
)
do
Knapsack
.
tracker
.
stop_timer
end
config
.
after
(
:suite
)
do
Knapsack
.
logger
.
info
(
Presenter
.
global_time
)
end
end
end
end
end
end
end
end
# Requires supporting ruby files with custom matchers and macros, etc,
...
...
This diff is collapsed.
Click to expand it.
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