Sha256: 79a49f82ae5f6a1700cb168e4b97877305c53f4d91e862887e65a4ee4c8e0912
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
require 'rspec/core' # require 'autotest/rspec2' require 'rails' require 'active_record' require 'arel' require 'meta_where' require 'yaml' require 'logger' require 'database_cleaner' require 'roles_active_record' module Rails def self.config_root_dir File.dirname(__FILE__) end end SPEC_DIR = File.dirname(__FILE__) path = SPEC_DIR + '/db/database.yml' dbfile = File.open(path) dbconfig = YAML::load(dbfile) ActiveRecord::Base.establish_connection(dbconfig) ActiveRecord::Base.logger = Logger.new(STDERR) DatabaseCleaner.strategy = :truncation def api_fixture end # $ rake VERSION=0 def migration_folder(name) path = File.dirname(__FILE__) + "/migrations/#{name}" end ORM_NAME = 'Active Record' def migrate(name) mig_folder = migration_folder(name) puts "Migrating folder: #{mig_folder}" ActiveRecord::Migrator.migrate mig_folder end RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean_with(:truncation) # DatabaseCleaner.clean end config.before(:each) do DatabaseCleaner.start migrate('users') end config.after(:each) do DatabaseCleaner.clean end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
roles_active_record-0.3.3 | spec/spec_helper.rb |
roles_active_record-0.3.2 | spec/spec_helper.rb |
roles_active_record-0.3.1 | spec/spec_helper.rb |