Add minimal tests for get/getg

bug/bundler_fix
Jon Hart 2015-01-15 14:46:12 -08:00
parent ba2c33132b
commit da1c56a65d
No known key found for this signature in database
GPG Key ID: 2FA9F0A3AFA8E9D3
2 changed files with 27 additions and 6 deletions

View File

@ -2317,6 +2317,12 @@ class Core
global = true
end
# No arguments? No cookie.
if args.empty?
global ? cmd_getg_help : cmd_get_help
return false
end
# Determine which data store we're operating on
if (active_module && !global)
datastore = active_module.datastore
@ -2324,12 +2330,6 @@ class Core
datastore = framework.datastore
end
# No arguments? No cookie.
if args.empty?
global ? cmd_getg_help : cmd_get_help
return false
end
args.each { |var| print_line("#{var} => #{datastore[var]}") }
end

View File

@ -95,4 +95,25 @@ describe Msf::Ui::Console::CommandDispatcher::Core do
end
end
end
it { is_expected.to respond_to :cmd_get }
it { is_expected.to respond_to :cmd_getg }
describe "#cmd_get" do
describe "without arguments" do
it "should show a help message" do
core.cmd_get
@output.join.should =~ /Usage: get /
end
end
end
describe "#cmd_getg" do
describe "without arguments" do
it "should show a help message" do
core.cmd_getg
@output.join.should =~ /Usage: getg /
end
end
end
end