Update spec_helper with all rspec 3 features

MSP-13484

Copied from metasploit-cache.
bug/bundler_fix
Luke Imhoff 2015-10-16 15:55:53 -05:00 committed by Brent Cook
parent d38ed931a5
commit ed1e984b6a
1 changed files with 50 additions and 15 deletions

View File

@ -14,13 +14,7 @@ require 'active_record/railtie'
require File.expand_path('../../config/environment', __FILE__)
# Don't `require 'rspec/rails'` as it includes support for pieces of rails that metasploit-framework doesn't use
require 'rspec/core'
require 'rails/version'
require 'rspec/rails/adapters'
require 'rspec/rails/extensions'
require 'rspec/rails/fixture_support'
require 'rspec/rails/matchers'
require 'rspec/rails/mocks'
require 'rspec/rails'
require 'metasploit/framework/spec'
@ -42,22 +36,63 @@ engines.each do |engine|
end
RSpec.configure do |config|
config.mock_with :rspec do |mocks|
mocks.yield_receiver_to_any_instance_implementation_blocks = true
config.raise_errors_for_deprecations!
config.expose_dsl_globally = false
# These two settings work together to allow you to limit a spec run
# to individual examples or groups you care about by tagging them with
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
# get run.
config.filter_run :focus
config.run_all_when_everything_filtered = true
# allow more verbose output when running an individual spec file.
if config.files_to_run.one?
# RSpec filters the backtrace by default so as not to be so noisy.
# This causes the full backtrace to be printed when running a single
# spec file (e.g. to troubleshoot a particular spec failure).
config.full_backtrace = true
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# 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'
config.order = :random
config.treat_symbols_as_metadata_keys_with_true_values = true
# 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
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
config.expect_with :rspec do |expectations|
# Enable only the newer, non-monkey-patching expect syntax.
expectations.syntax = :expect
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Enable only the newer, non-monkey-patching expect syntax.
# For more details, see:
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
mocks.syntax = :expect
mocks.patch_marshal_to_support_partial_doubles = false
# Prevents you from mocking or stubbing a method that does not exist on
# a real object.
mocks.verify_partial_doubles = true
end
end
Metasploit::Framework::Spec::Constants::Suite.configure!