summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsh McKenzie <amckenzie@gitlab.com>2018-09-25 15:07:51 +1000
committerAsh McKenzie <amckenzie@gitlab.com>2018-09-25 15:46:51 +1000
commit6a0d34427a637238b6776e4f994b315d6aa891e0 (patch)
tree990d233c522bfbcba0a1000ce6d31e4b078fd8aa
parent70570e763ad3a620b788e44cbdd1cc4d17d3f140 (diff)
downloadgitlab-shell-ash.mckenzie/display-feedback-v2.tar.gz
Remove HTTPCodes moduleash.mckenzie/display-feedback-v2
-rw-r--r--lib/gitlab_access_status.rb3
-rw-r--r--lib/http_codes.rb7
-rw-r--r--lib/http_helper.rb3
-rw-r--r--spec/gitlab_access_spec.rb4
-rw-r--r--spec/gitlab_shell_spec.rb6
5 files changed, 6 insertions, 17 deletions
diff --git a/lib/gitlab_access_status.rb b/lib/gitlab_access_status.rb
index 8483863..dd6562e 100644
--- a/lib/gitlab_access_status.rb
+++ b/lib/gitlab_access_status.rb
@@ -1,8 +1,7 @@
require 'json'
-require_relative 'http_codes'
class GitAccessStatus
- include HTTPCodes
+ HTTP_MULTIPLE_CHOICES = '300'.freeze
attr_reader :message, :gl_repository, :gl_id, :gl_username, :gitaly, :git_protocol, :git_config_options, :payload
diff --git a/lib/http_codes.rb b/lib/http_codes.rb
deleted file mode 100644
index 24340ec..0000000
--- a/lib/http_codes.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module HTTPCodes
- HTTP_SUCCESS = '200'.freeze
- HTTP_CREATED = '201'.freeze
- HTTP_MULTIPLE_CHOICES = '300'.freeze
- HTTP_UNAUTHORIZED = '401'.freeze
- HTTP_NOT_FOUND = '404'.freeze
-end
diff --git a/lib/http_helper.rb b/lib/http_helper.rb
index ac18f49..b2a6211 100644
--- a/lib/http_helper.rb
+++ b/lib/http_helper.rb
@@ -1,10 +1,7 @@
-require_relative 'http_codes'
require_relative 'httpunix'
require_relative 'gitlab_logger'
module HTTPHelper
- include HTTPCodes
-
READ_TIMEOUT = 300
CONTENT_TYPE_JSON = 'application/json'.freeze
diff --git a/spec/gitlab_access_spec.rb b/spec/gitlab_access_spec.rb
index c9922dd..92268e2 100644
--- a/spec/gitlab_access_spec.rb
+++ b/spec/gitlab_access_spec.rb
@@ -8,7 +8,7 @@ describe GitlabAccess do
let(:api) do
double(GitlabNet).tap do |api|
allow(api).to receive(:check_access).and_return(GitAccessStatus.new(true,
- HTTPCodes::HTTP_SUCCESS,
+ '200',
'ok',
gl_repository: 'project-1',
gl_id: 'user-123',
@@ -46,7 +46,7 @@ describe GitlabAccess do
before do
allow(api).to receive(:check_access).and_return(GitAccessStatus.new(
false,
- HTTPCodes::HTTP_UNAUTHORIZED,
+ '401',
'denied',
gl_repository: nil,
gl_id: nil,
diff --git a/spec/gitlab_shell_spec.rb b/spec/gitlab_shell_spec.rb
index 77fb6cd..eef572e 100644
--- a/spec/gitlab_shell_spec.rb
+++ b/spec/gitlab_shell_spec.rb
@@ -25,7 +25,7 @@ describe GitlabShell do
let(:gitaly_check_access) do
GitAccessStatus.new(
true,
- HTTPCodes::HTTP_SUCCESS,
+ '200',
'ok',
gl_repository: gl_repository,
gl_id: gl_id,
@@ -41,7 +41,7 @@ describe GitlabShell do
allow(api).to receive(:discover).and_return({ 'name' => 'John Doe', 'username' => 'testuser' })
allow(api).to receive(:check_access).and_return(GitAccessStatus.new(
true,
- HTTPCodes::HTTP_SUCCESS,
+ '200',
'ok',
gl_repository: gl_repository,
gl_id: gl_id,
@@ -262,7 +262,7 @@ describe GitlabShell do
let(:custom_action_gitlab_access_status) do
GitAccessStatus.new(
true,
- HTTPCodes::HTTP_MULTIPLE_CHOICES,
+ '300',
'Multiple Choices',
payload: fake_payload
)