Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
735db8b7
Commit
735db8b7
authored
Oct 01, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for active record peek view
parent
f09e10ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
spec/lib/peek/views/active_record_spec.rb
spec/lib/peek/views/active_record_spec.rb
+35
-0
No files found.
spec/lib/peek/views/active_record_spec.rb
View file @
735db8b7
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Peek
::
Views
::
ActiveRecord
,
:request_store
do
context
'when a class defines thresholds'
do
let
(
:threshold_view
)
do
Class
.
new
(
described_class
)
do
def
self
.
thresholds
{
calls:
1
,
cached_calls:
1
,
duration:
10
,
individual_call:
5
}
end
def
key
'threshold-view'
end
end
.
new
end
context
'when the results exceed the cached calls threshold'
do
before
do
allow
(
threshold_view
)
.
to
receive
(
:detail_store
).
and_return
([{
duration:
0.001
,
cached:
'cached'
},
{
duration:
0.001
,
cached:
'cached'
}])
end
it
'adds a warning to the results key'
do
expect
(
threshold_view
.
results
).
to
include
(
warnings:
[
a_string_matching
(
'threshold-view cached calls'
)])
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