Update init_module_paths spec to match Rails::Engine behavior

MSP-9653
bug/bundler_fix
Luke Imhoff 2014-06-02 14:26:35 -05:00
parent 1295028595
commit ca63d2201e
No known key found for this signature in database
GPG Key ID: 5B1FB01FB33356F8
1 changed files with 14 additions and 18 deletions

View File

@ -3,11 +3,11 @@ shared_examples_for 'Msf::Simple::Framework::ModulePaths' do
context '#init_module_paths' do
def init_module_paths
framework.init_module_paths
framework.init_module_paths(options)
end
let(:module_directory) do
nil
Rails.application.root.join('modules').expand_path.to_path
end
let(:user_module_directory) do
@ -23,7 +23,6 @@ shared_examples_for 'Msf::Simple::Framework::ModulePaths' do
# to init_module_paths doesn't get captured.
framework
Msf::Config.stub(:module_directory => module_directory)
Msf::Config.stub(:user_module_directory => user_module_directory)
end
@ -33,22 +32,15 @@ shared_examples_for 'Msf::Simple::Framework::ModulePaths' do
init_module_paths
end
it "adds Rails.application.paths['modules'] to module paths" do
expect(framework.modules).to receive(:add_module_path).with(module_directory, options)
init_module_paths
end
context 'Msf::Config' do
context 'module_directory' do
context 'without nil' do
let(:module_directory) do
'modules'
end
it 'should add Msf::Config.module_directory to module paths' do
framework.modules.should_receive(:add_module_path).with(
module_directory,
options
)
init_module_paths
end
end
before(:each) do
allow(Rails.application.paths).to receive(:[]).with('modules').and_return(nil)
end
context 'user_module_directory' do
@ -70,6 +62,10 @@ shared_examples_for 'Msf::Simple::Framework::ModulePaths' do
end
context 'datastore' do
before(:each) do
allow(Rails.application.paths).to receive(:[]).with('modules').and_return(nil)
end
context 'MsfModulePaths' do
let(:module_paths) do
module_paths = []