diff --git a/spec/lib/msf/core/exploit/remote/browser_profile_manager_spec.rb b/spec/lib/msf/core/exploit/remote/browser_profile_manager_spec.rb new file mode 100644 index 0000000000..a771fff517 --- /dev/null +++ b/spec/lib/msf/core/exploit/remote/browser_profile_manager_spec.rb @@ -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 \ No newline at end of file