diff --git a/lib/metasploit/framework/require.rb b/lib/metasploit/framework/require.rb index 8f398aa355..0196565d60 100644 --- a/lib/metasploit/framework/require.rb +++ b/lib/metasploit/framework/require.rb @@ -49,7 +49,7 @@ module Metasploit # # @return [void] def self.optionally_active_record_railtie - if ::File.exist?(Rails.application.config.paths['config/database'].first) + if ::File.exist?('config/database.yml') optionally( 'active_record/railtie', 'activerecord not in the bundle, so database support will be disabled.' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 29cd25fa70..b2986a4e37 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -11,6 +11,10 @@ end # Must be explicit as activerecord is optional dependency require 'active_record/railtie' +unless File.exist?('config/database.yml') + fail 'RSPEC currently needs a configured database' +end + 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