Sha256: 0d2ee41dceb47e5edd6deb6ff7b9558696f79b6f705286662ffaa5cf63754ced

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

require 'helper'

describe RdsRotateDbSnapshots::RdsClient do
  let(:options) do
    {
    aws_access_key: "ACCESS_KEY",
    aws_secret_access_key: "SECRET_KEY",
    aws_session_token: "SESSION_TOKEN",
    aws_region: "REGION"
  }
  end
  let(:rds_client) { described_class.new(options) }

  it 'configures the client with the correct credentials and region' do
    expect(rds_client.instance_variable_get(:@client).config.credentials)
      .to have_attributes(access_key_id: "ACCESS_KEY", secret_access_key: "SECRET_KEY", session_token: "SESSION_TOKEN")
    expect(rds_client.instance_variable_get(:@client).config.region).to eq("REGION")
  end

  it 'delegates describe_db_snapshots method to the @client object' do
    expect(rds_client.instance_variable_get(:@client)).to receive(:describe_db_snapshots)
    rds_client.describe_db_snapshots
  end

  it 'delegates create_db_snapshot method to the @client object' do
    expect(rds_client.instance_variable_get(:@client)).to receive(:create_db_snapshot)
    rds_client.create_db_snapshot("test-snapshot")
  end

  it 'delegates delete_db_snapshot method to the @client object' do
    expect(rds_client.instance_variable_get(:@client)).to receive(:delete_db_snapshot)
    rds_client.delete_db_snapshot("test-snapshot")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rds-rotate-db-snapshots-0.5.2 spec/lib/rds_rotate_db_snapshots/rds_client_spec.rb