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
479f03cf
Commit
479f03cf
authored
Mar 13, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add requirements index action
This action will be used by FE to setup Vue objects for Requirements UI.
parent
d0ce09be
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
0 deletions
+106
-0
ee/app/controllers/projects/requirements_controller.rb
ee/app/controllers/projects/requirements_controller.rb
+21
-0
ee/app/views/projects/requirements/index.html.haml
ee/app/views/projects/requirements/index.html.haml
+1
-0
ee/config/routes/project.rb
ee/config/routes/project.rb
+1
-0
ee/spec/controllers/projects/requirements_controller_spec.rb
ee/spec/controllers/projects/requirements_controller_spec.rb
+83
-0
No files found.
ee/app/controllers/projects/requirements_controller.rb
0 → 100644
View file @
479f03cf
# frozen_string_literal: true
class
Projects::RequirementsController
<
Projects
::
ApplicationController
before_action
:authorize_read_requirement!
before_action
:verify_requirements_management_flag!
before_action
do
push_frontend_feature_flag
(
:requirements_management
,
project
)
end
def
index
respond_to
do
|
format
|
format
.
html
end
end
private
def
verify_requirements_management_flag!
render_404
unless
Feature
.
enabled?
(
:requirements_management
,
project
)
end
end
ee/app/views/projects/requirements/index.html.haml
0 → 100644
View file @
479f03cf
=
_
(
'Not Implemented'
)
ee/config/routes/project.rb
View file @
479f03cf
...
...
@@ -11,6 +11,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
# Begin of the /-/ scope.
# Use this scope for all new project routes.
scope
'-'
do
resources
:requirements
,
only:
[
:index
]
resources
:packages
,
only:
[
:index
,
:show
,
:destroy
],
module: :packages
resources
:package_files
,
only:
[],
module: :packages
do
member
do
...
...
ee/spec/controllers/projects/requirements_controller_spec.rb
0 → 100644
View file @
479f03cf
# frozen_string_literal: true
require
'spec_helper'
describe
Projects
::
RequirementsController
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
subject
{
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
}
describe
'GET #index'
do
context
'with authorized user'
do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
end
context
'when feature is available'
do
before
do
stub_licensed_features
(
requirements:
true
)
end
it
'renders the index template'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
response
).
to
render_template
(
:index
)
end
context
'when requirements_management flag is disabled'
do
before
do
stub_feature_flags
(
requirements_management:
false
)
end
it
'returns 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
context
'when feature is not available'
do
before
do
stub_licensed_features
(
requirements:
false
)
end
it
'returns 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
context
'with unauthorized user'
do
before
do
sign_in
(
user
)
end
context
'when feature is available'
do
before
do
stub_licensed_features
(
requirements:
true
)
end
it
'returns 404'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
context
'with anonymous user'
do
it
'returns 302'
do
subject
expect
(
response
).
to
have_gitlab_http_status
(
:found
)
expect
(
response
).
to
redirect_to
(
new_user_session_path
)
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