Sha256: b7a22726c752c8997f3c5e81448f7d246863ac3b64d0d0d136977fe958f3f65d

Contents?: true

Size: 1.32 KB

Versions: 6

Compression:

Stored size: 1.32 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 'dynamoid'
require 'pry'
require 'mocha'

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

Dynamoid.configure do |config|
  config.adapter = 'aws_sdk'
  config.access_key = ENV['ACCESS_KEY']
  config.secret_key = ENV['SECRET_KEY']
  config.endpoint = 'localhost'
  config.port = '4567'
  config.use_ssl = false
  config.namespace = 'dynamoid_tests'
  config.warn_on_scan = false
end

Dynamoid.logger.level = Logger::FATAL

# 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
    Dynamoid::Adapter.list_tables.each do |table|
      if table =~ /^#{Dynamoid::Config.namespace}/
        table = Dynamoid::Adapter.get_table(table)
        table.items.each {|i| i.delete}
      end
    end
  end

  config.after(:suite) do
    Dynamoid::Adapter.list_tables.each do |table|
      Dynamoid::Adapter.delete_table(table) if table =~ /^#{Dynamoid::Config.namespace}/
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
dynamoid-0.6.0 spec/spec_helper.rb
adept_dynamoid-0.6.0 spec/spec_helper.rb
adept_dynamoid-0.5.0.8 spec/spec_helper.rb
adept_dynamoid-0.5.0.7 spec/spec_helper.rb
adept_dynamoid-0.5.0.6 spec/spec_helper.rb
dynamoid-0.5.0 spec/spec_helper.rb