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
Jérome Perrin
gitlab-ce
Commits
ae099857
Commit
ae099857
authored
Oct 23, 2016
by
Airat Shigapov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite events order spec to simulate wrong order without changing ids
parent
e15f15d5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
spec/requests/api/users_spec.rb
spec/requests/api/users_spec.rb
+10
-9
No files found.
spec/requests/api/users_spec.rb
View file @
ae099857
...
@@ -959,23 +959,24 @@ describe API::API, api: true do
...
@@ -959,23 +959,24 @@ describe API::API, api: true do
end
end
end
end
context
'when there are multiple events'
do
context
'when there are multiple events from different projects'
do
let
(
:old_note
)
{
create
(
:note_on_issue
,
project:
project
)
}
let
(
:another_project
)
{
create
(
:empty_project
)
}
let
(
:new_event
)
{
note
.
events
.
first
}
let
(
:notes
)
{
create_list
(
:note_on_issue
,
5
,
project:
[
project
,
another_project
].
sample
)
}
let
(
:old_event
)
{
old_note
.
events
.
first
}
before
do
before
do
EventCreateService
.
new
.
leave_note
(
old_note
,
us
er
)
another_project
.
add_user
(
user
,
:develop
er
)
new_event
.
update
(
id:
1000
)
notes
.
each
{
|
note
|
EventCreateService
.
new
.
leave_note
(
note
,
user
)
}
old_event
.
update
(
id:
900
)
end
end
it
'returns them in the correct order (from newest to oldest determined by ID field)'
do
it
'returns them in the correct order (from newest to oldest determined by ID field)'
do
get
api
(
"/users/
#{
user
.
id
}
/events"
,
user
)
get
api
(
"/users/
#{
user
.
id
}
/events"
,
user
)
expect
(
json_response
[
0
][
'target_id'
]).
to
eq
(
note
.
id
)
comment_events
=
json_response
.
select
{
|
e
|
e
[
'action_name'
]
==
'commented on'
}
expect
(
json_response
[
1
][
'target_id'
]).
to
eq
(
old_note
.
id
)
notes
.
reverse
.
each_with_index
do
|
note
,
i
|
expect
(
note
.
id
).
to
eq
(
comment_events
[
i
][
'target_id'
])
end
end
end
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