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
d2b8e54c
Commit
d2b8e54c
authored
Sep 13, 2020
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use let_it_be in requests/api/projects_spec.rb
* uses let_it_be for resources
parent
8672da3c
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
50 deletions
+43
-50
spec/requests/api/projects_spec.rb
spec/requests/api/projects_spec.rb
+39
-44
spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb
...xamples/requests/api/custom_attributes_shared_examples.rb
+4
-6
No files found.
spec/requests/api/projects_spec.rb
View file @
d2b8e54c
This diff is collapsed.
Click to expand it.
spec/support/shared_examples/requests/api/custom_attributes_shared_examples.rb
View file @
d2b8e54c
...
...
@@ -14,8 +14,7 @@ RSpec.shared_examples 'custom attributes endpoints' do |attributable_name|
get
api
(
"/
#{
attributable_name
}
"
,
user
),
params:
{
custom_attributes:
{
foo:
'foo'
,
bar:
'bar'
}
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
size
).
to
be
2
expect
(
json_response
.
map
{
|
r
|
r
[
'id'
]
}).
to
contain_exactly
attributable
.
id
,
other_attributable
.
id
expect
(
json_response
.
map
{
|
r
|
r
[
'id'
]
}).
to
include
(
attributable
.
id
,
other_attributable
.
id
)
end
end
...
...
@@ -40,7 +39,7 @@ RSpec.shared_examples 'custom attributes endpoints' do |attributable_name|
get
api
(
"/
#{
attributable_name
}
"
,
user
),
params:
{
with_custom_attributes:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
size
).
to
be
2
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
.
first
).
not_to
include
'custom_attributes'
end
end
...
...
@@ -50,16 +49,15 @@ RSpec.shared_examples 'custom attributes endpoints' do |attributable_name|
get
api
(
"/
#{
attributable_name
}
"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
size
).
to
be
2
expect
(
json_response
).
not_to
be_empty
expect
(
json_response
.
first
).
not_to
include
'custom_attributes'
expect
(
json_response
.
second
).
not_to
include
'custom_attributes'
end
it
'includes custom attributes if requested'
do
get
api
(
"/
#{
attributable_name
}
"
,
admin
),
params:
{
with_custom_attributes:
true
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
expect
(
json_response
.
size
).
to
be
2
expect
(
json_response
).
not_to
be_empty
attributable_response
=
json_response
.
find
{
|
r
|
r
[
'id'
]
==
attributable
.
id
}
other_attributable_response
=
json_response
.
find
{
|
r
|
r
[
'id'
]
==
other_attributable
.
id
}
...
...
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