50 lines
1.2 KiB
Ruby
50 lines
1.2 KiB
Ruby
require 'core/loader.rb'
|
|
|
|
# Notes
|
|
# We need to load vairables that 'beef' usually does for us
|
|
## config
|
|
config = BeEF::Core::Configuration.new('config.yaml')
|
|
## home_dir
|
|
$home_dir = Dir.pwd
|
|
## root_dir
|
|
$root_dir = Dir.pwd
|
|
|
|
require 'core/bootstrap.rb'
|
|
require 'rack/test'
|
|
require 'curb'
|
|
require 'rest-client'
|
|
|
|
# Require supports
|
|
Dir['spec/support/*.rb'].each do |f|
|
|
require f
|
|
end
|
|
|
|
ENV['RACK_ENV'] ||= 'test'
|
|
ARGV = []
|
|
|
|
ActiveRecord::Base.logger = nil
|
|
OTR::ActiveRecord.migrations_paths = [File.join('core', 'main', 'ar-migrations')]
|
|
OTR::ActiveRecord.configure_from_hash!(adapter:'sqlite3', database:':memory:')
|
|
ActiveRecord::Schema.verbose = false
|
|
context = ActiveRecord::Migration.new.migration_context
|
|
if context.needs_migration?
|
|
ActiveRecord::Migrator.new(:up, context.migrations, context.schema_migration).migrate
|
|
end
|
|
|
|
RSpec.configure do |config|
|
|
config.disable_monkey_patching!
|
|
config.bisect_runner = :shell
|
|
config.order = :random
|
|
Kernel.srand config.seed
|
|
config.include Rack::Test::Methods
|
|
config.expect_with :rspec do |c|
|
|
c.syntax = :expect
|
|
end
|
|
config.around do |example|
|
|
ActiveRecord::Base.transaction do
|
|
example.run
|
|
raise ActiveRecord::Rollback
|
|
end
|
|
end
|
|
end
|