Sha256: 424683bf5c0a243a9b679b4dfe35d8ed6d229dd182dd60da9545da0aad167cfe

Contents?: true

Size: 1.54 KB

Versions: 15

Compression:

Stored size: 1.54 KB

Contents

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

MODELS = File.join(File.dirname(__FILE__), "app/models")

require 'rspec'
require 'dyna_model'
require 'mocha'
require 'aws-sdk'

ENV['ACCESS_KEY'] ||= 'abcd'
ENV['SECRET_KEY'] ||= '1234'

aws_config = {
  access_key_id: ENV['ACCESS_KEY'],
  secret_access_key: ENV['SECRET_KEY'],
  dynamo_db_endpoint: 'localhost',
  dynamo_db_port: '4567',
  use_ssl: false
}
AWS.config(aws_config)

DynaModel::configure do |config|
  config.endpoint = 'localhost'
  config.port = 4567
  config.use_ssl = false
  config.read_provision = 5
  config.write_provision = 1
  config.namespace = 'test-'
end

# Requires supporting files with custom matchers and macros, etc,
# in ./support/ and its subdirectories.
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

Dir[ File.join(MODELS, "*.rb") ].sort.each { |file| require file }

RSpec.configure do |config|
  config.mock_with(:mocha)

  config.before(:each) do
    client = AWS::DynamoDB::Client.new(aws_config.merge(api_version: '2012-08-10'))
    client.list_tables[:table_names].each do |table|
      if table =~ /^#{DynaModel::Config.namespace}/
        client.delete_table(table_name: table)
      end
    end
  end

  config.after(:suite) do
    client = AWS::DynamoDB::Client.new(aws_config.merge(api_version: '2012-08-10'))
    client.list_tables[:table_names].each do |table|
      if table =~ /^#{DynaModel::Config.namespace}/
        client.delete_table(table_name: table)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dyna_model-0.0.15 spec/spec_helper.rb
dyna_model-0.0.14 spec/spec_helper.rb
dyna_model-0.0.13 spec/spec_helper.rb
dyna_model-0.0.12 spec/spec_helper.rb
dyna_model-0.0.11 spec/spec_helper.rb
dyna_model-0.0.10 spec/spec_helper.rb
dyna_model-0.0.9 spec/spec_helper.rb
dyna_model-0.0.8 spec/spec_helper.rb
dyna_model-0.0.7 spec/spec_helper.rb
dyna_model-0.0.6 spec/spec_helper.rb
dyna_model-0.0.5 spec/spec_helper.rb
dyna_model-0.0.4 spec/spec_helper.rb
dyna_model-0.0.3 spec/spec_helper.rb
dyna_model-0.0.2 spec/spec_helper.rb
dyna_model-0.0.1 spec/spec_helper.rb