From 32af09b2487bd6c7c970686b1947f86f4ac026a8 Mon Sep 17 00:00:00 2001 From: Jake Webster Date: Thu, 22 Jan 2026 17:33:28 +1000 Subject: [PATCH] FIX: command_spec test --- spec/beef/core/main/command_spec.rb | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/spec/beef/core/main/command_spec.rb b/spec/beef/core/main/command_spec.rb index 476bf6f2b..4605f6f1e 100644 --- a/spec/beef/core/main/command_spec.rb +++ b/spec/beef/core/main/command_spec.rb @@ -1,13 +1,23 @@ RSpec.describe 'BeEF Command class testing' do - it 'should return a beef configuration variable' do - 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') + let(:config) { BeEF::Core::Configuration.instance } - require 'modules/browser/hooked_origin/get_page_links/module' - gpl = Get_page_links.new('test_get_variable') - expect(gpl.config.beef_host).to eq('0.0.0.0') + before do + # Ensure modules are loaded + 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