summaryrefslogtreecommitdiff
path: root/spec/requests/customers_dot
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 23:50:22 +0000
commit9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch)
tree70467ae3692a0e35e5ea56bcb803eb512a10bedb /spec/requests/customers_dot
parent4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff)
downloadgitlab-ce-9dc93a4519d9d5d7be48ff274127136236a3adb3.tar.gz
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'spec/requests/customers_dot')
-rw-r--r--spec/requests/customers_dot/proxy_controller_spec.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/spec/requests/customers_dot/proxy_controller_spec.rb b/spec/requests/customers_dot/proxy_controller_spec.rb
new file mode 100644
index 00000000000..4938c67e0c3
--- /dev/null
+++ b/spec/requests/customers_dot/proxy_controller_spec.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe CustomersDot::ProxyController, type: :request do
+ describe 'POST graphql' do
+ let_it_be(:customers_dot) { "#{Gitlab::SubscriptionPortal::SUBSCRIPTIONS_URL}/graphql" }
+
+ it 'forwards request body to customers dot' do
+ request_params = '{ "foo" => "bar" }'
+
+ stub_request(:post, customers_dot)
+
+ post customers_dot_proxy_graphql_path, params: request_params
+
+ expect(WebMock).to have_requested(:post, customers_dot).with(body: request_params)
+ end
+
+ it 'responds with customers dot status' do
+ stub_request(:post, customers_dot).to_return(status: 500)
+
+ post customers_dot_proxy_graphql_path
+
+ expect(response).to have_gitlab_http_status(:internal_server_error)
+ end
+
+ it 'responds with customers dot response body' do
+ customers_dot_response = 'foo'
+
+ stub_request(:post, customers_dot).to_return(body: customers_dot_response)
+
+ post customers_dot_proxy_graphql_path
+
+ expect(response.body).to eq(customers_dot_response)
+ end
+ end
+end