Sha256: 7bdeeeb06c1efe10de26d95dc156db202729a06ebe6425dbcc5103a860c8e353

Contents?: true

Size: 947 Bytes

Versions: 4

Compression:

Stored size: 947 Bytes

Contents

require "rubygems"
require "bundler"

Bundler.require :default, :development, :test

# Combustion initialization has to happend before loading rspec/rails
Combustion.initialize! "sequel_rails"

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

RSpec.configure do |config|
  config.around :each do |example|
    Sequel::Model.db.transaction(rollback: :always) do
      example.run
    end
  end
end

# Ensure db exists and clean state
begin
  require "sequel_rails/storage"
  silence(:stdout) do
    SequelRails::Storage.adapter_for(:test).drop
    SequelRails::Storage.adapter_for(:test).create
  end

  require 'sequel/extensions/migration'
  load "#{Rails.root}/db/schema.rb"
  Sequel::Migration.descendants.first.apply Sequel::Model.db, :up
rescue Sequel::DatabaseConnectionError => e
  puts "Database connection error: #{e.message}"
  puts "Ensure test db exists before running specs."
  exit 1
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sequel-rails-0.4.0 spec/spec_helper.rb
sequel-rails-0.4.0.pre2 spec/spec_helper.rb
sequel-rails-0.4.0.pre1 spec/spec_helper.rb
sequel-rails-0.4.0.pre spec/spec_helper.rb