Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

80 lines (64 sloc) 1.91 kb
# Configure Rails Envinronment
ENV["RAILS_ENV"] = "test"
ENV['SKIP_RAILS_ADMIN_INITIALIZER'] = 'true'
CI_ORM = (ENV['CI_ORM'] || :active_record).to_sym
CI_TARGET_ORMS = [:active_record, :mongoid]
PK_COLUMN = {:active_record=>:id, :mongoid=>:_id}[CI_ORM]
if ENV['INVOKE_SIMPLECOV']
require 'simplecov'
SimpleCov.start 'rails'
end
require File.expand_path('../dummy_app/config/environment', __FILE__)
require 'rspec/rails'
require 'factory_girl'
require 'factories'
require 'database_cleaner'
require "orm/#{CI_ORM}"
ActionMailer::Base.delivery_method = :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.default_url_options[:host] = "example.com"
Rails.backtrace_cleaner.remove_silencers!
ENV['SKIP_RAILS_ADMIN_INITIALIZER'] = 'false'
# Don't need passwords in test DB to be secure, but we would like 'em to be
# fast -- and the stretches mechanism is intended to make passwords
# computationally expensive.
module Devise
module Models
module DatabaseAuthenticatable
protected
def password_digest(password)
password
end
end
end
end
Devise.setup do |config|
config.stretches = 0
end
RSpec.configure do |config|
require 'rspec/expectations'
config.include RSpec::Matchers
config.include RailsAdmin::Engine.routes.url_helpers
config.include Warden::Test::Helpers
config.before(:each) do
DatabaseCleaner.start
RailsAdmin::Config.reset
RailsAdmin::AbstractModel.reset
RailsAdmin::Config.audit_with(:history) if CI_ORM == :active_record
login_as User.create(
:email => "username@example.com",
:password => "password"
)
end
config.after(:each) do
Warden.test_reset!
DatabaseCleaner.clean
end
CI_TARGET_ORMS.each do |orm|
if orm == CI_ORM
config.filter_run_excluding "skip_#{orm}".to_sym => true
else
config.filter_run_excluding orm => true
end
end
end
Jump to Line
Something went wrong with that request. Please try again.