2014-08-27 21:46:23 +00:00
|
|
|
Before do
|
2016-07-27 17:18:02 +00:00
|
|
|
set_env('MSF_DATABASE_CONFIG', Rails.configuration.paths['config/database'].existent.first)
|
2014-08-27 21:46:23 +00:00
|
|
|
set_env('RAILS_ENV', 'test')
|
2014-11-24 14:43:25 +00:00
|
|
|
@aruba_timeout_seconds = 8.minutes
|
2014-11-24 14:07:00 +00:00
|
|
|
end
|
|
|
|
|
2016-07-27 17:18:02 +00:00
|
|
|
Before('@db') do |scenario|
|
|
|
|
dbconfig = YAML::load(File.open(Metasploit::Framework::Database.configurations_pathname))
|
|
|
|
ActiveRecord::Base.establish_connection(dbconfig["test"])
|
|
|
|
end
|
|
|
|
|
2014-12-05 17:58:09 +00:00
|
|
|
# don't setup child processes to load simplecov_setup.rb if simplecov isn't installed
|
2016-05-11 19:05:34 +00:00
|
|
|
# unless Bundler.settings.without.include?(:coverage)
|
|
|
|
# Before do |scenario|
|
|
|
|
# command_name = case scenario
|
|
|
|
# when Cucumber::Ast::Scenario, Cucumber::Ast::ScenarioOutline
|
|
|
|
# "#{scenario.feature.title} #{scenario.name}"
|
|
|
|
# when Cucumber::Ast::OutlineTable::ExampleRow
|
|
|
|
# scenario_outline = scenario.scenario_outline
|
|
|
|
#
|
|
|
|
# "#{scenario_outline.feature.title} #{scenario_outline.name} #{scenario.name}"
|
|
|
|
# else
|
|
|
|
# raise TypeError, "Don't know how to extract command name from #{scenario.class}"
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# # Used in simplecov_setup so that each scenario has a different name and their coverage results are merged instead
|
|
|
|
# # of overwriting each other as 'Cucumber Features'
|
|
|
|
# set_env('SIMPLECOV_COMMAND_NAME', command_name)
|
|
|
|
#
|
|
|
|
# simplecov_setup_pathname = Pathname.new(__FILE__).expand_path.parent.join('simplecov_setup')
|
|
|
|
# # set environment variable so child processes will merge their coverage data with parent process's coverage data.
|
|
|
|
# set_env('RUBYOPT', "#{ENV['RUBYOPT']} -r#{simplecov_setup_pathname}")
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# Before('@db') do |scenario|
|
|
|
|
# dbconfig = YAML::load(File.open(Metasploit::Framework::Database.configurations_pathname))
|
|
|
|
# ActiveRecord::Base.establish_connection(dbconfig["test"])
|
|
|
|
# end
|
|
|
|
# end
|