Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
be5b38f5
Commit
be5b38f5
authored
Jul 31, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename NotFound -> NotFoundError
parent
ac424489
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
lib/gitlab_net.rb
lib/gitlab_net.rb
+2
-2
lib/http_helper.rb
lib/http_helper.rb
+1
-1
spec/gitlab_net_spec.rb
spec/gitlab_net_spec.rb
+4
-4
No files found.
lib/gitlab_net.rb
View file @
be5b38f5
...
...
@@ -95,14 +95,14 @@ class GitlabNet
def
post_receive
(
gl_repository
,
identifier
,
changes
)
params
=
{
gl_repository:
gl_repository
,
identifier:
identifier
,
changes:
changes
}
resp
=
post
(
"
#{
internal_api_endpoint
}
/post_receive"
,
params
)
raise
NotFound
if
resp
.
code
==
HTTP_NOT_FOUND
raise
NotFound
Error
if
resp
.
code
==
HTTP_NOT_FOUND
JSON
.
parse
(
resp
.
body
)
if
resp
.
code
==
HTTP_SUCCESS
end
def
pre_receive
(
gl_repository
)
resp
=
post
(
"
#{
internal_api_endpoint
}
/pre_receive"
,
gl_repository:
gl_repository
)
raise
NotFound
if
resp
.
code
==
HTTP_NOT_FOUND
raise
NotFound
Error
if
resp
.
code
==
HTTP_NOT_FOUND
JSON
.
parse
(
resp
.
body
)
if
resp
.
code
==
HTTP_SUCCESS
end
...
...
lib/http_helper.rb
View file @
be5b38f5
...
...
@@ -14,7 +14,7 @@ module HTTPHelper
HTTP_SUCCESS_LIKE
=
[
HTTP_SUCCESS
,
HTTP_MULTIPLE_CHOICES
].
freeze
class
ApiUnreachableError
<
StandardError
;
end
class
NotFound
<
StandardError
;
end
class
NotFound
Error
<
StandardError
;
end
protected
...
...
spec/gitlab_net_spec.rb
View file @
be5b38f5
...
...
@@ -145,9 +145,9 @@ describe GitlabNet, vcr: true do
end
end
it
'throws a NotFound
e
rror when pre-receive is not available'
do
it
'throws a NotFound
E
rror when pre-receive is not available'
do
VCR
.
use_cassette
(
"pre-receive-not-found"
)
do
expect
do
subject
end
.
to
raise_error
(
GitlabNet
::
NotFound
)
expect
do
subject
end
.
to
raise_error
(
GitlabNet
::
NotFound
Error
)
end
end
end
...
...
@@ -185,9 +185,9 @@ describe GitlabNet, vcr: true do
end
end
it
'throws a NotFound
e
rror when post-receive is not available'
do
it
'throws a NotFound
E
rror when post-receive is not available'
do
VCR
.
use_cassette
(
"post-receive-not-found"
)
do
expect
do
subject
end
.
to
raise_error
(
GitlabNet
::
NotFound
)
expect
do
subject
end
.
to
raise_error
(
GitlabNet
::
NotFound
Error
)
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