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
d15fb4cc
Commit
d15fb4cc
authored
Mar 05, 2021
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix TestCasesController permission inconsistency
parent
0d347294
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
ee/app/controllers/projects/quality/test_cases_controller.rb
ee/app/controllers/projects/quality/test_cases_controller.rb
+1
-1
ee/spec/controllers/projects/quality/test_cases_controller_spec.rb
...ontrollers/projects/quality/test_cases_controller_spec.rb
+14
-6
No files found.
ee/app/controllers/projects/quality/test_cases_controller.rb
View file @
d15fb4cc
...
...
@@ -5,7 +5,7 @@ class Projects::Quality::TestCasesController < Projects::ApplicationController
before_action
:check_quality_management_available!
before_action
:authorize_read_issue!
before_action
:authorize_
create
_issue!
,
only:
[
:new
]
before_action
:authorize_
admin
_issue!
,
only:
[
:new
]
feature_category
:quality_management
...
...
ee/spec/controllers/projects/quality/test_cases_controller_spec.rb
View file @
d15fb4cc
...
...
@@ -4,13 +4,14 @@ require 'spec_helper'
RSpec
.
describe
Projects
::
Quality
::
TestCasesController
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:non_member
)
{
create
(
:user
)
}
let_it_be
(
:guest
)
{
create
(
:project_member
,
:guest
,
project:
project
).
user
}
let_it_be
(
:reporter
)
{
create
(
:project_member
,
:reporter
,
project:
project
).
user
}
shared_examples_for
'test case action'
do
|
template
|
context
'with authorized user'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
authorized_user
)
end
context
'when feature is available'
do
...
...
@@ -41,7 +42,7 @@ RSpec.describe Projects::Quality::TestCasesController do
context
'with unauthorized user'
do
before
do
sign_in
(
user
)
sign_in
(
u
nauthorized_u
ser
)
end
context
'when feature is available'
do
...
...
@@ -69,18 +70,26 @@ RSpec.describe Projects::Quality::TestCasesController do
describe
'GET'
do
describe
'#index'
do
let_it_be
(
:authorized_user
)
{
guest
}
let_it_be
(
:unauthorized_user
)
{
non_member
}
subject
{
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
}
it_behaves_like
'test case action'
,
:index
end
describe
'#new'
do
let_it_be
(
:authorized_user
)
{
reporter
}
let_it_be
(
:unauthorized_user
)
{
guest
}
subject
{
get
:new
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
}
it_behaves_like
'test case action'
,
:new
end
describe
'#show'
do
let_it_be
(
:authorized_user
)
{
guest
}
let_it_be
(
:unauthorized_user
)
{
non_member
}
let_it_be
(
:test_case
)
{
create
(
:quality_test_case
,
project:
project
)
}
subject
{
get
:show
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
,
id:
test_case
}
}
...
...
@@ -90,8 +99,7 @@ RSpec.describe Projects::Quality::TestCasesController do
context
'when feature is enabled and user has access'
do
before
do
stub_licensed_features
(
quality_management:
true
)
project
.
add_developer
(
user
)
sign_in
(
user
)
sign_in
(
authorized_user
)
end
it
'assigns test case related variables'
do
...
...
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