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
32679232
Commit
32679232
authored
Oct 24, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the rest of the stages to the controller and relevant specs
parent
d4726112
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
7 deletions
+85
-7
app/controllers/projects/cycle_analytics/events_controller.rb
...controllers/projects/cycle_analytics/events_controller.rb
+32
-4
config/routes/project.rb
config/routes/project.rb
+7
-1
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+46
-2
No files found.
app/controllers/projects/cycle_analytics/events_controller.rb
View file @
32679232
class
Projects::CycleAnalytics::EventsController
<
Projects
::
ApplicationController
class
Projects::CycleAnalytics::EventsController
<
Projects
::
ApplicationController
#before_action :authorize_read_cycle_analytics!
#before_action :authorize_read_cycle_analytics!
def
issues
def
issue
respond_to
do
|
format
|
render_events
(
events
.
issue_events
)
format
.
html
end
format
.
json
{
render
json:
events
.
issue_events
}
def
plan
render_events
(
events
.
plan_events
)
end
def
code
render_events
(
events
.
code_events
)
end
def
test
render_events
(
events
.
test_events
)
end
def
review
render_events
(
events
.
review_events
)
end
end
def
staging
render_events
(
events
.
staging_events
)
end
def
production
render_events
(
events
.
production_events
)
end
end
private
private
def
render_events
(
event_list
)
respond_to
do
|
format
|
format
.
html
format
.
json
{
render
json:
{
events:
event_list
}
}
end
end
# TODO refactor this
# TODO refactor this
def
start_date
def
start_date
case
events_params
[
:start_date
]
case
events_params
[
:start_date
]
...
...
config/routes/project.rb
View file @
32679232
...
@@ -155,7 +155,13 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only:
...
@@ -155,7 +155,13 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only:
namespace
:cycle_analytics
do
namespace
:cycle_analytics
do
scope
:events
,
controller:
'/projects/cycle_analytics/events'
do
scope
:events
,
controller:
'/projects/cycle_analytics/events'
do
get
:issues
get
:issue
get
:plan
get
:code
get
:test
get
:review
get
:staging
get
:production
end
end
end
end
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
32679232
...
@@ -3,18 +3,62 @@ require 'spec_helper'
...
@@ -3,18 +3,62 @@ require 'spec_helper'
describe
'cycle analytics events'
do
describe
'cycle analytics events'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
before
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
update
(
milestone:
milestone
)
create_merge_request_closing_issue
(
issue
)
merge_merge_requests_closing_issue
(
issue
)
deploy_master
login_as
(
user
)
login_as
(
user
)
end
end
it
'lists the issue events'
do
it
'lists the issue events'
do
get
namespace_project_cycle_analytics_issues_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_issue_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the plan events'
do
get
namespace_project_cycle_analytics_plan_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the code events'
do
get
namespace_project_cycle_analytics_code_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the test events'
do
get
namespace_project_cycle_analytics_test_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the review events'
do
get
namespace_project_cycle_analytics_review_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the staging events'
do
get
namespace_project_cycle_analytics_staging_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'events'
]).
not_to
be_empty
end
it
'lists the production events'
do
get
namespace_project_cycle_analytics_production_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
).
to
eq
([])
expect
(
json_response
[
'events'
]).
not_to
be_empty
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