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
c3469aab
Commit
c3469aab
authored
Aug 24, 2020
by
Peter Leitzen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up metrics dashboard annotation policy specs
Use `let_it_be` where applicable
parent
925b98af
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
12 deletions
+14
-12
spec/policies/metrics/dashboard/annotation_policy_spec.rb
spec/policies/metrics/dashboard/annotation_policy_spec.rb
+14
-12
No files found.
spec/policies/metrics/dashboard/annotation_policy_spec.rb
View file @
c3469aab
...
...
@@ -3,6 +3,10 @@
require
'spec_helper'
RSpec
.
describe
Metrics
::
Dashboard
::
AnnotationPolicy
,
:models
do
let
(
:policy
)
{
described_class
.
new
(
user
,
annotation
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
shared_examples
'metrics dashboard annotation policy'
do
context
'when guest'
do
before
do
...
...
@@ -51,23 +55,21 @@ RSpec.describe Metrics::Dashboard::AnnotationPolicy, :models do
describe
'rules'
do
context
'environments annotation'
do
let
(
:annotation
)
{
create
(
:metrics_dashboard_annotation
,
environment:
environment
)
}
let
(
:environment
)
{
create
(
:environment
)
}
let!
(
:project
)
{
environment
.
project
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:policy
)
{
described_class
.
new
(
user
,
annotation
)
}
let_it_be
(
:environment
)
{
create
(
:environment
)
}
let_it_be
(
:annotation
)
{
create
(
:metrics_dashboard_annotation
,
environment:
environment
)
}
it_behaves_like
'metrics dashboard annotation policy'
it_behaves_like
'metrics dashboard annotation policy'
do
let
(
:project
)
{
environment
.
project
}
end
end
context
'cluster annotation'
do
let
(
:annotation
)
{
create
(
:metrics_dashboard_annotation
,
environment:
nil
,
cluster:
cluster
)
}
let
(
:cluster
)
{
create
(
:cluster
,
:project
)
}
let
(
:project
)
{
cluster
.
project
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:policy
)
{
described_class
.
new
(
user
,
annotation
)
}
let_it_be
(
:cluster
)
{
create
(
:cluster
,
:project
)
}
let_it_be
(
:annotation
)
{
create
(
:metrics_dashboard_annotation
,
environment:
nil
,
cluster:
cluster
)
}
it_behaves_like
'metrics dashboard annotation policy'
it_behaves_like
'metrics dashboard annotation policy'
do
let
(
:project
)
{
cluster
.
project
}
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