Commit be5b38f5 authored by Ash McKenzie's avatar Ash McKenzie

Rename NotFound -> NotFoundError

parent ac424489
...@@ -95,14 +95,14 @@ class GitlabNet ...@@ -95,14 +95,14 @@ class GitlabNet
def post_receive(gl_repository, identifier, changes) def post_receive(gl_repository, identifier, changes)
params = { gl_repository: gl_repository, identifier: identifier, changes: changes } params = { gl_repository: gl_repository, identifier: identifier, changes: changes }
resp = post("#{internal_api_endpoint}/post_receive", params) resp = post("#{internal_api_endpoint}/post_receive", params)
raise NotFound if resp.code == HTTP_NOT_FOUND raise NotFoundError if resp.code == HTTP_NOT_FOUND
JSON.parse(resp.body) if resp.code == HTTP_SUCCESS JSON.parse(resp.body) if resp.code == HTTP_SUCCESS
end end
def pre_receive(gl_repository) def pre_receive(gl_repository)
resp = post("#{internal_api_endpoint}/pre_receive", gl_repository: gl_repository) resp = post("#{internal_api_endpoint}/pre_receive", gl_repository: gl_repository)
raise NotFound if resp.code == HTTP_NOT_FOUND raise NotFoundError if resp.code == HTTP_NOT_FOUND
JSON.parse(resp.body) if resp.code == HTTP_SUCCESS JSON.parse(resp.body) if resp.code == HTTP_SUCCESS
end end
......
...@@ -14,7 +14,7 @@ module HTTPHelper ...@@ -14,7 +14,7 @@ module HTTPHelper
HTTP_SUCCESS_LIKE = [HTTP_SUCCESS, HTTP_MULTIPLE_CHOICES].freeze HTTP_SUCCESS_LIKE = [HTTP_SUCCESS, HTTP_MULTIPLE_CHOICES].freeze
class ApiUnreachableError < StandardError; end class ApiUnreachableError < StandardError; end
class NotFound < StandardError; end class NotFoundError < StandardError; end
protected protected
......
...@@ -145,9 +145,9 @@ describe GitlabNet, vcr: true do ...@@ -145,9 +145,9 @@ describe GitlabNet, vcr: true do
end end
end end
it 'throws a NotFound error when pre-receive is not available' do it 'throws a NotFoundError when pre-receive is not available' do
VCR.use_cassette("pre-receive-not-found") 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::NotFoundError)
end end
end end
end end
...@@ -185,9 +185,9 @@ describe GitlabNet, vcr: true do ...@@ -185,9 +185,9 @@ describe GitlabNet, vcr: true do
end end
end end
it 'throws a NotFound error when post-receive is not available' do it 'throws a NotFoundError when post-receive is not available' do
VCR.use_cassette("post-receive-not-found") 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::NotFoundError)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment