Sha256: 16ff76a24e038170d1089476bffd3ef4835df510384d7a861136c4041b612cfb

Contents?: true

Size: 1.77 KB

Versions: 12

Compression:

Stored size: 1.77 KB

Contents

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec', 'models')))
$LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'aasm'
require 'minitest/autorun'
require 'aasm/minitest_spec'
require 'pry'

# require 'ruby-debug'; Debugger.settings[:autoeval] = true; debugger; rubys_debugger = 'annoying'
# require 'ruby-debug/completion'
# require 'pry'

SEQUEL_DB = defined?(JRUBY_VERSION) ? 'jdbc:sqlite::memory:' : 'sqlite:/'

def load_schema
  require 'logger'
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
  ActiveRecord::Base.establish_connection(config['sqlite3'])
  require File.dirname(__FILE__) + "/database.rb"
end

# Dynamoid initialization
begin
  require 'dynamoid'
  require 'aws-sdk-resources'

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

  Aws.config.update({
    region: 'us-west-2',
    credentials: Aws::Credentials.new(ENV['ACCESS_KEY'], ENV['SECRET_KEY'])
  })

  Dynamoid.configure do |config|
    config.namespace = 'dynamoid_tests'
    config.endpoint = "http://#{ENV['DYNAMODB_HOST'] || '127.0.0.1'}:30180"
    config.warn_on_scan = false
  end

  Dynamoid.logger.level = Logger::FATAL

  class Minitest::Spec
    before do
      Dynamoid.adapter.list_tables.each do |table|
        Dynamoid.adapter.delete_table(table) if table =~ /^#{Dynamoid::Config.namespace}/
      end
      Dynamoid.adapter.tables.clear
    end
  end
rescue LoadError
  # Without Dynamoid settings
end

# example model classes
Dir[File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec', 'models')) + '/*.rb'].sort.each { |f| require File.expand_path(f) }

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
aasm-5.2.0 test/minitest_helper.rb
aasm-5.1.1 test/minitest_helper.rb
aasm-5.1.0 test/minitest_helper.rb
aasm-5.0.8 test/minitest_helper.rb
aasm-5.0.7 test/minitest_helper.rb
aasm-5.0.6 test/minitest_helper.rb
aasm-5.0.5 test/minitest_helper.rb
aasm-5.0.4 test/minitest_helper.rb
aasm-5.0.3 test/minitest_helper.rb
aasm-5.0.2 test/minitest_helper.rb
aasm-5.0.1 test/minitest_helper.rb
aasm-5.0.0 test/minitest_helper.rb