diff --git a/spec/lib/msf/core/exploit/http/server_spec.rb b/spec/lib/msf/core/exploit/http/server_spec.rb index 84469dea41..929d8e6f62 100644 --- a/spec/lib/msf/core/exploit/http/server_spec.rb +++ b/spec/lib/msf/core/exploit/http/server_spec.rb @@ -6,6 +6,7 @@ require 'msf/core' require 'msf/core/exploit/http/server' describe Msf::Exploit::Remote::HttpServer do + subject(:server_module) do mod = Msf::Exploit.allocate mod.extend described_class @@ -26,6 +27,9 @@ describe Msf::Exploit::Remote::HttpServer do Rex::ServiceManager.stub(:start => mock_service) end + # Ensure the class is hooks Metasploit::Concern + it_should_behave_like 'Metasploit::Concern.run' + describe "#add_resource" do it "should call the ServiceManager's add_resource" do server_module.start_service diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65ec812da1..26d87fe257 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,10 +22,19 @@ require 'rspec/rails/mocks' FILE_FIXTURES_PATH = File.expand_path(File.dirname(__FILE__)) + '/file_fixtures/' +# Load the shared examples from the following engines +engines = [ + Metasploit::Concern, + Rails +] + # Requires supporting ruby files with custom matchers and macros, etc, # in spec/support/ and its subdirectories. -Dir[Rails.root.join('spec', 'support', '**', '*.rb')].each do |f| - require f +engines.each do |engine| + support_glob = engine.root.join('spec', 'support', '**', '*.rb') + Dir[support_glob].each { |f| + require f + } end RSpec.configure do |config|