Sha256: a7c1a9a28799412d6b0d263eefc543194f9b5a0dbfcd240fc77c7662adcaba01

Contents?: true

Size: 1.59 KB

Versions: 4

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

# Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
#     http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompanying this file. This file is
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific
# language governing permissions and limitations under the License.

require 'spec_helper'
require 'stringio'
require 'logger'

module Aws
  module SessionStore
    module DynamoDB
      describe Table do
        context 'Mock Table Methods Tests', integration: true do
          let(:table_name) { "sessionstore-integration-test-#{Time.now.to_i}" }
          let(:options) { { table_name: table_name } }
          let(:io) { StringIO.new }

          before { allow(Table).to receive(:logger) { Logger.new(io) } }

          it 'Creates and deletes a new table' do
            Table.create_table(options)

            # second attempt should warn
            Table.create_table(options)

            expect(io.string).to include("Table #{table_name} created, waiting for activation...\n")
            expect(io.string).to include("Table #{table_name} is now ready to use.\n")
            expect(io.string).to include("Table #{table_name} already exists, skipping creation.\n")

            # now delete table
            Table.delete_table(options)
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aws-sessionstore-dynamodb-2.2.0 spec/aws/session_store/dynamo_db/table_spec.rb
aws-sessionstore-dynamodb-2.1.0 spec/aws/session_store/dynamo_db/table_spec.rb
aws-sessionstore-dynamodb-2.0.1 spec/aws/session_store/dynamo_db/table_spec.rb
aws-sessionstore-dynamodb-2.0.0 spec/aws/session_store/dynamo_db/table_spec.rb