BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4917bbd7
Unverified
Commit
4917bbd7
authored
Oct 10, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speed up specs for GET /projects/:id/events
From 8.15s to 4.55s by grouping expectations Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
b06acbf5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
projects_spec.rb
spec/requests/api/projects_spec.rb
+15
-13
No files found.
spec/requests/api/projects_spec.rb
View file @
4917bbd7
...
...
@@ -588,37 +588,39 @@ describe API::API, api: true do
before
do
note
=
create
(
:note_on_issue
,
note:
'What an awesome day!'
,
project:
project
)
EventCreateService
.
new
.
leave_note
(
note
,
note
.
author
)
get
api
(
"/projects/
#{
project
.
id
}
/events"
,
user
)
end
it
{
expect
(
response
).
to
have_http_status
(
200
)
}
it
'returns all events'
do
get
api
(
"/projects/
#{
project
.
id
}
/events"
,
user
)
context
'joined event'
do
let
(
:json_event
)
{
json_response
[
1
]
}
expect
(
response
).
to
have_http_status
(
200
)
it
{
expect
(
json_event
[
'action_name'
]).
to
eq
(
'joined'
)
}
it
{
expect
(
json_event
[
'project_id'
].
to_i
).
to
eq
(
project
.
id
)
}
it
{
expect
(
json_event
[
'author_username'
]).
to
eq
(
user3
.
username
)
}
it
{
expect
(
json_event
[
'author'
][
'name'
]).
to
eq
(
user3
.
name
)
}
end
first_event
=
json_response
.
first
context
'comment event'
do
let
(
:json_event
)
{
json_response
.
first
}
expect
(
first_event
[
'action_name'
]).
to
eq
(
'commented on'
)
expect
(
first_event
[
'note'
][
'body'
]).
to
eq
(
'What an awesome day!'
)
it
{
expect
(
json_event
[
'action_name'
]).
to
eq
(
'commented on'
)
}
it
{
expect
(
json_event
[
'note'
][
'body'
]).
to
eq
(
'What an awesome day!'
)
}
last_event
=
json_response
.
last
expect
(
last_event
[
'action_name'
]).
to
eq
(
'joined'
)
expect
(
last_event
[
'project_id'
].
to_i
).
to
eq
(
project
.
id
)
expect
(
last_event
[
'author_username'
]).
to
eq
(
user3
.
username
)
expect
(
last_event
[
'author'
][
'name'
]).
to
eq
(
user3
.
name
)
end
end
it
'returns a 404 error if not found'
do
get
api
(
'/projects/42/events'
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
json_response
[
'message'
]).
to
eq
(
'404 Project Not Found'
)
end
it
'returns a 404 error if user is not a member'
do
other_user
=
create
(
:user
)
get
api
(
"/projects/
#{
project
.
id
}
/events"
,
other_user
)
expect
(
response
).
to
have_http_status
(
404
)
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