Add rspec for browser_profile_manager

bug/bundler_fix
wchen-r7 2015-07-11 21:11:31 -05:00
parent b2d723e4a3
commit 5a858d68a5
1 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,51 @@
require 'msf/core'
describe Msf::Exploit::Remote::BrowserProfileManager do
subject do
mod = Msf::Exploit::Remote.allocate
mod.extend described_class
mod
end
let(:default_profile) do
{
'PREFIX' => {'KEY'=>'VALUE'}
}
end
before(:each) do
framework = double('framework')
allow(framework).to receive(:browser_profiles).and_return(default_profile)
allow_any_instance_of(described_class).to receive(:framework).and_return(framework)
end
describe '#browser_profile_prefix' do
it 'raises a NoMethodError' do
expect{subject.browser_profile_prefix}.to raise_exception(NoMethodError)
end
end
describe '#browser_profile' do
before(:each) do
allow(subject).to receive(:browser_profile_prefix).and_return('PREFIX')
end
it 'returns a hash for the profile' do
expect(subject.browser_profile).to be_kind_of(Hash)
end
end
describe '#clear_browser_profiles' do
before(:each) do
allow(subject).to receive(:browser_profile_prefix).and_return('PREFIX')
end
it 'clears profile cache' do
expect(subject.browser_profile.length).to eq(1)
subject.clear_browser_profiles
expect(subject.browser_profile).to be_empty
end
end
end