Sha256: c297a94581376a996719957fd4f962960be570dbb3d646369a6df231d848c829

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

require "active_support"
require "active_record"
require "database_cleaner"

ENV['debug'] = 'test' unless ENV['debug']

# Establish DB Connection
config = YAML::load(IO.read(File.join(File.dirname(__FILE__), 'db', 'database.yml')))
ActiveRecord::Base.configurations = {'test' => config[ENV['DB'] || 'sqlite3']}
ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])

# Load Test Schema into the Database
load(File.dirname(__FILE__) + "/db/schema.rb")

# Load in our code
$LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../lib"

require 'has_validated_attributes'

RSpec.configure do |config|

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
  end

  config.before(:each) do
    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
has_validated_attributes-0.0.3 spec/spec_helper.rb
has_validated_attributes-0.0.2 spec/spec_helper.rb
has_validated_attributes-0.0.1 spec/spec_helper.rb