2014-08-15 16:33:31 +00:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
ENV['RAILS_ENV'] = 'test'
|
2012-10-08 21:14:37 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
require 'simplecov'
|
2013-07-18 17:44:48 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
# @note must be before loading config/environment because railtie needs to be loaded before
|
|
|
|
# `Metasploit::Framework::Application.initialize!` is called.
|
|
|
|
#
|
|
|
|
# Must be explicit as activerecord is optional dependency
|
|
|
|
require 'active_record/railtie'
|
2012-10-08 21:14:37 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
require File.expand_path('../../config/environment', __FILE__)
|
2012-11-06 22:30:41 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
# Don't `require 'rspec/rails'` as it includes support for pieces of rails that metasploit-framework doesn't use
|
2012-10-08 21:14:37 +00:00
|
|
|
require 'rspec/core'
|
2014-08-15 16:33:31 +00:00
|
|
|
require 'rails/version'
|
|
|
|
require 'rspec/rails/adapters'
|
|
|
|
require 'rspec/rails/extensions'
|
|
|
|
require 'rspec/rails/fixture_support'
|
|
|
|
require 'rspec/rails/matchers'
|
|
|
|
require 'rspec/rails/mocks'
|
|
|
|
|
|
|
|
FILE_FIXTURES_PATH = File.expand_path(File.dirname(__FILE__)) + '/file_fixtures/'
|
2012-10-08 21:14:37 +00:00
|
|
|
|
2014-09-12 15:52:57 +00:00
|
|
|
# Load the shared examples from the following engines
|
|
|
|
engines = [
|
|
|
|
Metasploit::Concern,
|
|
|
|
Rails
|
|
|
|
]
|
|
|
|
|
2012-10-08 21:14:37 +00:00
|
|
|
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
|
|
# in spec/support/ and its subdirectories.
|
2014-09-12 15:52:57 +00:00
|
|
|
engines.each do |engine|
|
|
|
|
support_glob = engine.root.join('spec', 'support', '**', '*.rb')
|
|
|
|
Dir[support_glob].each { |f|
|
|
|
|
require f
|
|
|
|
}
|
2012-10-08 21:14:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
RSpec.configure do |config|
|
2014-09-08 02:18:22 +00:00
|
|
|
config.mock_with :rspec do |mocks|
|
|
|
|
mocks.yield_receiver_to_any_instance_implementation_blocks = true
|
|
|
|
end
|
2013-04-01 21:06:40 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
# Run specs in random order to surface order dependencies. If you find an
|
|
|
|
# order dependency and want to debug it, you can fix the order by providing
|
|
|
|
# the seed, which is printed after each run.
|
|
|
|
# --seed 1234
|
|
|
|
config.order = 'random'
|
2012-10-08 21:14:37 +00:00
|
|
|
|
2014-08-15 16:33:31 +00:00
|
|
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
|
|
# examples within a transaction, remove the following line or assign false
|
|
|
|
# instead of true.
|
|
|
|
config.use_transactional_fixtures = true
|
|
|
|
end
|