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
f98601f4
Commit
f98601f4
authored
Aug 18, 2021
by
Alexander Turinske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update policies_helper test to be more readable
parent
a4d9af49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
23 deletions
+12
-23
ee/spec/helpers/projects/security/policies_helper_spec.rb
ee/spec/helpers/projects/security/policies_helper_spec.rb
+12
-23
No files found.
ee/spec/helpers/projects/security/policies_helper_spec.rb
View file @
f98601f4
...
...
@@ -46,7 +46,10 @@ RSpec.describe Projects::Security::PoliciesHelper do
environments_endpoint:
kind_of
(
String
),
project_path:
project
.
full_path
,
project_id:
project
.
id
,
threat_monitoring_path:
kind_of
(
String
)
threat_monitoring_path:
kind_of
(
String
),
environment_id:
environment
&
.
id
,
policy:
policy
&
.
to_json
,
policy_type:
policy_type
}
end
...
...
@@ -55,18 +58,14 @@ RSpec.describe Projects::Security::PoliciesHelper do
allow
(
helper
).
to
receive
(
:can?
).
with
(
owner
,
:update_security_orchestration_policy_project
,
project
)
{
true
}
end
subject
{
helper
.
orchestration_policy_data
(
project
,
policy_type
,
policy
,
environment
)
}
context
'when a new policy is being created'
do
subject
{
helper
.
orchestration_policy_data
(
project
)
}
it
'returns expected policy data'
do
expect
(
subject
).
to
match
(
base_data
.
merge
(
environment_id:
nil
,
policy:
nil
,
policy_type:
nil
)
)
end
let
(
:environment
)
{
nil
}
let
(
:policy
)
{
nil
}
let
(
:policy_type
)
{
nil
}
it
{
is_expected
.
to
match
(
base_data
)
}
end
context
'when an existing policy is being edited'
do
...
...
@@ -82,17 +81,7 @@ RSpec.describe Projects::Security::PoliciesHelper do
)
end
subject
{
helper
.
orchestration_policy_data
(
project
,
policy_type
,
policy
,
environment
)
}
it
'returns expected policy data'
do
expect
(
subject
).
to
match
(
base_data
.
merge
(
environment_id:
environment
.
id
,
policy:
policy
.
to_json
,
policy_type:
policy_type
)
)
end
it
{
is_expected
.
to
match
(
base_data
)
}
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