diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2018-01-11 11:27:19 +0000 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2018-01-11 11:27:19 +0000 |
commit | 59adc07f00f4f3ea326194d77c31580edfdfb2a4 (patch) | |
tree | d6411d883c339a1b9fe7fd5c6e0949d319114842 /spec/services | |
parent | e55899ff4217cf2281c7fff762a5aca0cb89bcb7 (diff) | |
parent | cf8429867021f20e671c02115b9c6806acd2d739 (diff) | |
download | gitlab-ce-59adc07f00f4f3ea326194d77c31580edfdfb2a4.tar.gz |
Merge branch 'gcp-fix' into 'master'
Fix GCP redirect
Closes #41867
See merge request gitlab-org/gitlab-ce!16355
Diffstat (limited to 'spec/services')
-rw-r--r-- | spec/services/check_gcp_project_billing_service_spec.rb | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/spec/services/check_gcp_project_billing_service_spec.rb b/spec/services/check_gcp_project_billing_service_spec.rb index f0e39ba6f49..3e68d906e71 100644 --- a/spec/services/check_gcp_project_billing_service_spec.rb +++ b/spec/services/check_gcp_project_billing_service_spec.rb @@ -1,29 +1,30 @@ require 'spec_helper' describe CheckGcpProjectBillingService do + include GoogleApi::CloudPlatformHelpers + let(:service) { described_class.new } - let(:projects) { [double(name: 'first_project'), double(name: 'second_project')] } + let(:project_id) { 'test-project-1234' } describe '#execute' do before do - expect_any_instance_of(GoogleApi::CloudPlatform::Client) - .to receive(:projects_list).and_return(projects) - - allow_any_instance_of(GoogleApi::CloudPlatform::Client) - .to receive_message_chain(:projects_get_billing_info, :billingEnabled) - .and_return(project_billing_enabled) + stub_cloud_platform_projects_list(project_id: project_id) end subject { service.execute('bogustoken') } context 'google account has a billing enabled gcp project' do - let(:project_billing_enabled) { true } + before do + stub_cloud_platform_projects_get_billing_info(project_id, true) + end - it { is_expected.to eq(projects) } + it { is_expected.to all(satisfy { |project| project.project_id == project_id }) } end context 'google account does not have a billing enabled gcp project' do - let(:project_billing_enabled) { false } + before do + stub_cloud_platform_projects_get_billing_info(project_id, false) + end it { is_expected.to eq([]) } end |