Skip to content

Commit

Permalink
Improve tests for 2.7 ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
le0pard committed Apr 16, 2020
1 parent 570a572 commit e8f8c2a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions spec/global/backend/gcp_secret_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,26 @@

require 'spec_helper'
require 'google/cloud/secret_manager'
require 'google/cloud/secretmanager/v1/service_services_pb'
require 'global/backend/gcp_secret_manager'

RSpec.describe Global::Backend::GcpSecretManager do
let(:client) do
double(Google::Cloud::SecretManager::V1::SecretManagerService::Stub)
end
let(:client) { double() }

subject do
described_class.new(prefix: 'prod-myapp-', client: client, project_id: 'example')
end

before do
@match_item = double(Google::Cloud::SecretManager::V1::Secret)
@match_item = double()
allow(@match_item).to receive(:name).and_return('prod-myapp-example-test_key')

@secret_data = double
allow(@secret_data).to receive_message_chain(:payload, :data).and_return('secret value')

@not_match_item = double(Google::Cloud::SecretManager::V1::Secret)
@not_match_item = double()
allow(@not_match_item).to receive(:name).and_return('different_key')

@list = double(Google::Cloud::SecretManager::V1::ListSecretsRequest)
@list = double()
allow(@list).to receive(:next_page_token).and_return('')
allow(@list).to receive(:each).and_yield(@match_item).and_yield(@not_match_item)

Expand Down

0 comments on commit e8f8c2a

Please sign in to comment.