FIX: command_spec test
This commit is contained in:
@@ -1,13 +1,23 @@
|
|||||||
RSpec.describe 'BeEF Command class testing' do
|
RSpec.describe 'BeEF Command class testing' do
|
||||||
it 'should return a beef configuration variable' do
|
let(:config) { BeEF::Core::Configuration.instance }
|
||||||
expect {
|
|
||||||
BeEF::Modules.load if BeEF::Core::Configuration.instance.get('beef.module').nil?
|
|
||||||
}.to_not raise_error
|
|
||||||
command_mock = BeEF::Core::Command.new('test_get_variable')
|
|
||||||
expect(command_mock.config.beef_host).to eq('0.0.0.0')
|
|
||||||
|
|
||||||
require 'modules/browser/hooked_origin/get_page_links/module'
|
before do
|
||||||
gpl = Get_page_links.new('test_get_variable')
|
# Ensure modules are loaded
|
||||||
expect(gpl.config.beef_host).to eq('0.0.0.0')
|
BeEF::Modules.load if config.get('beef.module').nil?
|
||||||
|
|
||||||
|
# Set up a test module configuration if it doesn't exist
|
||||||
|
unless config.get('beef.module.test_get_variable')
|
||||||
|
config.set('beef.module.test_get_variable.name', 'Test Get Variable')
|
||||||
|
config.set('beef.module.test_get_variable.path', 'modules/test/')
|
||||||
|
config.set('beef.module.test_get_variable.mount', '/command/test_get_variable.js')
|
||||||
|
config.set('beef.module.test_get_variable.db.id', 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should return a beef configuration variable' do
|
||||||
|
expect do
|
||||||
|
command_mock = BeEF::Core::Command.new('test_get_variable')
|
||||||
|
expect(command_mock.config.beef_host).to eq('0.0.0.0')
|
||||||
|
end.to_not raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user