More use of be_falsey
parent
dd1c015e4e
commit
a1e1cef418
|
@ -268,7 +268,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false if :force is false' do
|
it 'should return false if :force is false' do
|
||||||
subject.load_module(parent_path, type, module_reference_name, :force => false).should be_false
|
subject.load_module(parent_path, type, module_reference_name, :force => false).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not call #read_module_content' do
|
it 'should not call #read_module_content' do
|
||||||
|
@ -352,7 +352,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
|
|
||||||
# if the module eval error includes the module_path then the module_path was passed along correctly
|
# if the module eval error includes the module_path then the module_path was passed along correctly
|
||||||
subject.should_receive(:elog).with(/#{Regexp.escape(module_path)}/)
|
subject.should_receive(:elog).with(/#{Regexp.escape(module_path)}/)
|
||||||
subject.load_module(parent_path, type, module_reference_name, :reload => true).should be_false
|
subject.load_module(parent_path, type, module_reference_name, :reload => true).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with empty module content' do
|
context 'with empty module content' do
|
||||||
|
@ -361,12 +361,12 @@ describe Msf::Modules::Loader::Base do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not attempt to make a new namespace_module' do
|
it 'should not attempt to make a new namespace_module' do
|
||||||
subject.should_not_receive(:namespace_module_transaction)
|
subject.should_not_receive(:namespace_module_transaction)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
|
|
||||||
it 'should record the load error using the original error' do
|
it 'should record the load error using the original error' do
|
||||||
subject.should_receive(:load_error).with(module_path, error)
|
subject.should_receive(:load_error).with(module_path, error)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -457,14 +457,14 @@ describe Msf::Modules::Loader::Base do
|
||||||
|
|
||||||
it 'should record the load error using the Msf::Modules::VersionCompatibilityError' do
|
it 'should record the load error using the Msf::Modules::VersionCompatibilityError' do
|
||||||
subject.should_receive(:load_error).with(module_path, version_compatibility_error)
|
subject.should_receive(:load_error).with(module_path, version_compatibility_error)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
@namespace_module.stub(:version_compatible!).with(module_path, module_reference_name)
|
@namespace_module.stub(:version_compatible!).with(module_path, module_reference_name)
|
||||||
|
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -520,11 +520,11 @@ describe Msf::Modules::Loader::Base do
|
||||||
|
|
||||||
it 'should record the load error' do
|
it 'should record the load error' do
|
||||||
subject.should_receive(:load_error).with(module_path, version_compatibility_error)
|
subject.should_receive(:load_error).with(module_path, version_compatibility_error)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should restore the old namespace module' do
|
it 'should restore the old namespace module' do
|
||||||
|
@ -558,15 +558,15 @@ describe Msf::Modules::Loader::Base do
|
||||||
module_path,
|
module_path,
|
||||||
kind_of(Msf::Modules::MetasploitClassCompatibilityError)
|
kind_of(Msf::Modules::MetasploitClassCompatibilityError)
|
||||||
)
|
)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should restore the old namespace module' do
|
it 'should restore the old namespace module' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
Msf::Modules.const_defined?(relative_name).should be_true
|
Msf::Modules.const_defined?(relative_name).should be_true
|
||||||
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
||||||
end
|
end
|
||||||
|
@ -593,15 +593,15 @@ describe Msf::Modules::Loader::Base do
|
||||||
|
|
||||||
it 'should log information' do
|
it 'should log information' do
|
||||||
subject.should_receive(:ilog).with(/#{module_reference_name}/, 'core', LEV_1)
|
subject.should_receive(:ilog).with(/#{module_reference_name}/, 'core', LEV_1)
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should restore the old namespace module' do
|
it 'should restore the old namespace module' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
Msf::Modules.const_defined?(relative_name).should be_true
|
Msf::Modules.const_defined?(relative_name).should be_true
|
||||||
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
Msf::Modules.const_get(relative_name).should == @original_namespace_module
|
||||||
end
|
end
|
||||||
|
@ -654,7 +654,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
it 'should set the count to 1 if it does not exist' do
|
it 'should set the count to 1 if it does not exist' do
|
||||||
count_by_type = {}
|
count_by_type = {}
|
||||||
|
|
||||||
count_by_type.has_key?(type).should be_false
|
count_by_type.has_key?(type).should be_falsey
|
||||||
subject.load_module(
|
subject.load_module(
|
||||||
parent_path,
|
parent_path,
|
||||||
type,
|
type,
|
||||||
|
@ -802,7 +802,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return nil if the module is not defined' do
|
it 'should return nil if the module is not defined' do
|
||||||
Msf::Modules.const_defined?(relative_name).should be_false
|
Msf::Modules.const_defined?(relative_name).should be_falsey
|
||||||
subject.send(:current_module, module_names).should be_nil
|
subject.send(:current_module, module_names).should be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -838,7 +838,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
it 'should return false if path is hidden' do
|
it 'should return false if path is hidden' do
|
||||||
hidden_path = '.hidden/path/file.rb'
|
hidden_path = '.hidden/path/file.rb'
|
||||||
|
|
||||||
subject.send(:module_path?, hidden_path).should be_false
|
subject.send(:module_path?, hidden_path).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false if the file extension is not MODULE_EXTENSION' do
|
it 'should return false if the file extension is not MODULE_EXTENSION' do
|
||||||
|
@ -846,7 +846,7 @@ describe Msf::Modules::Loader::Base do
|
||||||
path = "path/with/wrong/extension#{non_module_extension}"
|
path = "path/with/wrong/extension#{non_module_extension}"
|
||||||
|
|
||||||
non_module_extension.should_not == described_class::MODULE_EXTENSION
|
non_module_extension.should_not == described_class::MODULE_EXTENSION
|
||||||
subject.send(:module_path?, path).should be_false
|
subject.send(:module_path?, path).should be_falsey
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false if the file is a unit test' do
|
it 'should return false if the file is a unit test' do
|
||||||
|
|
|
@ -74,7 +74,7 @@ describe Msf::Modules::Loader::Directory do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not load the module' do
|
it 'should not load the module' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ describe Msf::Modules::Loader::Directory do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not load the module' do
|
it 'should not load the module' do
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -110,7 +110,7 @@ describe Msf::Modules::Loader::Directory do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should not raise an error' do
|
it 'should not raise an error' do
|
||||||
File.exist?(module_path).should be_false
|
File.exist?(module_path).should be_falsey
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
subject.load_module(parent_path, type, module_reference_name)
|
subject.load_module(parent_path, type, module_reference_name)
|
||||||
|
@ -118,9 +118,9 @@ describe Msf::Modules::Loader::Directory do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return false' do
|
it 'should return false' do
|
||||||
File.exist?(module_path).should be_false
|
File.exist?(module_path).should be_falsey
|
||||||
|
|
||||||
subject.load_module(parent_path, type, module_reference_name).should be_false
|
subject.load_module(parent_path, type, module_reference_name).should be_falsey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -138,7 +138,7 @@ describe Msf::Modules::Loader::Directory do
|
||||||
# this ensures that the File.exist?(module_path) checks are checking the same path as the code under test
|
# this ensures that the File.exist?(module_path) checks are checking the same path as the code under test
|
||||||
it 'should attempt to open the expected module_path' do
|
it 'should attempt to open the expected module_path' do
|
||||||
File.should_receive(:open).with(module_path, 'rb')
|
File.should_receive(:open).with(module_path, 'rb')
|
||||||
File.exist?(module_path).should be_false
|
File.exist?(module_path).should be_falsey
|
||||||
|
|
||||||
subject.send(:read_module_content, parent_path, type, module_reference_name)
|
subject.send(:read_module_content, parent_path, type, module_reference_name)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue