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
0d9cce41
Commit
0d9cce41
authored
Feb 09, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove a transient failure from spec/requests/api/groups_spec.rb
parent
e355d8fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+5
-3
spec/support/matchers/satisfy_matchers.rb
spec/support/matchers/satisfy_matchers.rb
+19
-0
No files found.
spec/requests/api/groups_spec.rb
View file @
0d9cce41
...
@@ -35,7 +35,8 @@ describe API::Groups, api: true do
...
@@ -35,7 +35,8 @@ describe API::Groups, api: true do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
group1
.
name
)
expect
(
json_response
)
.
to
satisfy_one
{
|
group
|
group
[
'name'
]
==
group1
.
name
}
end
end
it
"does not include statistics"
do
it
"does not include statistics"
do
...
@@ -70,7 +71,7 @@ describe API::Groups, api: true do
...
@@ -70,7 +71,7 @@ describe API::Groups, api: true do
repository_size:
123
,
repository_size:
123
,
lfs_objects_size:
234
,
lfs_objects_size:
234
,
build_artifacts_size:
345
,
build_artifacts_size:
345
,
}
}
.
stringify_keys
project1
.
statistics
.
update!
(
attributes
)
project1
.
statistics
.
update!
(
attributes
)
...
@@ -78,7 +79,8 @@ describe API::Groups, api: true do
...
@@ -78,7 +79,8 @@ describe API::Groups, api: true do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
first
[
'statistics'
]).
to
eq
attributes
.
stringify_keys
expect
(
json_response
)
.
to
satisfy_one
{
|
group
|
group
[
'statistics'
]
==
attributes
}
end
end
end
end
...
...
spec/support/matchers/satisfy_matchers.rb
0 → 100644
View file @
0d9cce41
# These matchers are a syntactic hack to provide more readable expectations for
# an Enumerable object.
#
# They take advantage of the `all?`, `none?`, and `one?` methods, and the fact
# that RSpec provides a `be_something` matcher for all predicates.
#
# Example:
#
# # Ensure exactly one object in an Array satisfies a condition
# expect(users.one? { |u| u.admin? }).to eq true
#
# # The same thing, but using the `be_one` matcher
# expect(users).to be_one { |u| u.admin? }
#
# # The same thing again, but using `satisfy_one` for improved readability
# expect(users).to satisfy_one { |u| u.admin? }
RSpec
::
Matchers
.
alias_matcher
:satisfy_all
,
:be_all
RSpec
::
Matchers
.
alias_matcher
:satisfy_none
,
:be_none
RSpec
::
Matchers
.
alias_matcher
:satisfy_one
,
:be_one
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