Commit 1cf4977d authored by Rubén Dávila's avatar Rubén Dávila

Address suggestions from last code review

Rename method and update specs.
parent 98a45e2b
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module GitlabSubscriptions module GitlabSubscriptions
class CreateLeadService class CreateLeadService
def execute(company_params) def execute(company_params)
response = subscription_app_client.create_trial_account(company_params) response = subscription_app_client.generate_trial(company_params)
if response.success if response.success
{ success: true } { success: true }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Gitlab module Gitlab
module SubscriptionPortal module SubscriptionPortal
class Client class Client
def create_trial_account(params) def generate_trial(params)
parse_response(Gitlab::HTTP.post("#{base_url}/trials", parse_response(Gitlab::HTTP.post("#{base_url}/trials",
body: params.to_json, body: params.to_json,
headers: headers)) headers: headers))
......
...@@ -8,7 +8,7 @@ describe Gitlab::SubscriptionPortal::Client do ...@@ -8,7 +8,7 @@ describe Gitlab::SubscriptionPortal::Client do
let(:httparty_response) { double(code: http_response.code, response: http_response, body: {}.to_json) } let(:httparty_response) { double(code: http_response.code, response: http_response, body: {}.to_json) }
subject do subject do
described_class.new.create_trial_account({}) described_class.new.generate_trial({})
end end
context 'when response is successful' do context 'when response is successful' do
...@@ -31,7 +31,7 @@ describe Gitlab::SubscriptionPortal::Client do ...@@ -31,7 +31,7 @@ describe Gitlab::SubscriptionPortal::Client do
end end
end end
context 'when response code is generic' do context 'when response code is 500' do
let(:http_response) { Net::HTTPServerError.new(1.0, '500', 'Error') } let(:http_response) { Net::HTTPServerError.new(1.0, '500', 'Error') }
it 'has a server error status' do it 'has a server error status' do
......
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