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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
449a9fb1
Commit
449a9fb1
authored
Nov 04, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed integration spec after big refactoring of fields per stage
parent
f59b8afc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
+33
-23
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+33
-23
No files found.
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
449a9fb1
...
@@ -14,71 +14,78 @@ describe 'cycle analytics events' do
...
@@ -14,71 +14,78 @@ describe 'cycle analytics events' do
login_as
(
user
)
login_as
(
user
)
end
end
it
'lists the issue events
in the right order
'
do
it
'lists the issue events'
do
get
namespace_project_cycle_analytics_issue_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_issue_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
event
s'
]).
not_to
be_empty
expect
(
json_response
[
'
issue
s'
]).
not_to
be_empty
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'
event
s'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
expect
(
json_response
[
'
issue
s'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
end
end
it
'lists the plan events
in the right order
'
do
it
'lists the plan events'
do
get
namespace_project_cycle_analytics_plan_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_plan_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
even
ts'
]).
not_to
be_empty
expect
(
json_response
[
'
commi
ts'
]).
not_to
be_empty
first_date
=
DateTime
.
parse
(
json_response
[
'events'
].
first
[
'commit'
][
'authored_date'
])
commits
=
[]
last_date
=
DateTime
.
parse
(
json_response
[
'events'
].
last
[
'commit'
][
'authored_date'
])
expect
(
first_date
).
to
be
>
last_date
MergeRequest
.
all
.
each
do
|
mr
|
mr
.
merge_request_diff
.
st_commits
.
each
do
|
commit
|
commits
<<
{
date:
commit
[
:authored_date
],
sha:
commit
[
:id
]
}
end
end
end
newest_sha
=
commits
.
sort_by
{
|
k
|
k
[
'date'
]
}.
first
[
:sha
][
0
...
8
]
it
'lists the code events in the right order'
do
expect
(
json_response
[
'commits'
].
first
[
'sha'
]).
to
eq
(
newest_sha
)
end
it
'lists the code events'
do
get
namespace_project_cycle_analytics_code_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_code_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
even
ts'
]).
not_to
be_empty
expect
(
json_response
[
'
merge_reques
ts'
]).
not_to
be_empty
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'
even
ts'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
expect
(
json_response
[
'
merge_reques
ts'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
end
end
it
'lists the test events
in the right order
'
do
it
'lists the test events'
do
get
namespace_project_cycle_analytics_test_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_test_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
event
s'
]).
not_to
be_empty
expect
(
json_response
[
'
build
s'
]).
not_to
be_empty
expect
(
json_response
[
'
events'
].
first
[
'pipelin
e'
]).
not_to
be_empty
expect
(
json_response
[
'
builds'
].
first
[
'dat
e'
]).
not_to
be_empty
end
end
it
'lists the review events
in the right order
'
do
it
'lists the review events'
do
get
namespace_project_cycle_analytics_review_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_review_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
even
ts'
]).
not_to
be_empty
expect
(
json_response
[
'
merge_reques
ts'
]).
not_to
be_empty
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
first_mr_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'
even
ts'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
expect
(
json_response
[
'
merge_reques
ts'
].
first
[
'iid'
]).
to
eq
(
first_mr_iid
)
end
end
it
'lists the staging events
in the right order
'
do
it
'lists the staging events'
do
get
namespace_project_cycle_analytics_staging_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_staging_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
event
s'
]).
not_to
be_empty
expect
(
json_response
[
'
build
s'
]).
not_to
be_empty
expect
(
json_response
[
'
events'
].
first
[
'pipelin
e'
]).
not_to
be_empty
expect
(
json_response
[
'
builds'
].
first
[
'dat
e'
]).
not_to
be_empty
end
end
it
'lists the production events
in the right order
'
do
it
'lists the production events'
do
get
namespace_project_cycle_analytics_production_path
(
project
.
namespace
,
project
,
format: :json
)
get
namespace_project_cycle_analytics_production_path
(
project
.
namespace
,
project
,
format: :json
)
expect
(
json_response
[
'
event
s'
]).
not_to
be_empty
expect
(
json_response
[
'
issue
s'
]).
not_to
be_empty
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
first_issue_iid
=
Issue
.
order
(
created_at: :desc
).
pluck
(
:iid
).
first
.
to_s
expect
(
json_response
[
'
event
s'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
expect
(
json_response
[
'
issue
s'
].
first
[
'iid'
]).
to
eq
(
first_issue_iid
)
end
end
end
end
...
@@ -95,6 +102,9 @@ describe 'cycle analytics events' do
...
@@ -95,6 +102,9 @@ describe 'cycle analytics events' do
pipeline
=
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
mr
.
source_branch
,
sha:
mr
.
source_branch_sha
)
pipeline
=
create
(
:ci_empty_pipeline
,
status:
'created'
,
project:
project
,
ref:
mr
.
source_branch
,
sha:
mr
.
source_branch_sha
)
pipeline
.
run
pipeline
.
run
create
(
:ci_build
,
pipeline:
pipeline
,
status: :success
,
author:
user
)
create
(
:ci_build
,
pipeline:
pipeline
,
status: :success
,
author:
user
)
merge_merge_requests_closing_issue
(
issue
)
merge_merge_requests_closing_issue
(
issue
)
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