Add specs for Msf::Jmx::MBean::ServerConnection#create_mbean_stream

bug/bundler_fix
jvazquez-r7 2015-01-20 18:59:25 -06:00
parent 0b2d65749b
commit 7e2f9b32b3
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
# -*- coding:binary -*-
require 'spec_helper'
require 'rex/java'
require 'msf/jmx'
describe Msf::Jmx::MBean::ServerConnection do
subject(:mod) do
mod = ::Msf::Exploit.new
mod.extend ::Msf::Jmx
mod.send(:initialize)
mod
end
let(:mbean_name) { 'MBeanSample' }
describe "#create_mbean_stream" do
it "returns a Rex::Java::Serialization::Model::Stream" do
expect(mod.create_mbean_stream).to be_a(Rex::Java::Serialization::Model::Stream)
end
context "when no opts" do
it "builds a default stream" do
expect(mod.create_mbean_stream.contents[1].contents).to eq('')
end
end
context "when opts" do
it "builds a stream having opts into account" do
expect(mod.create_mbean_stream(name: 'MBeanSample').contents[1].contents).to eq('MBeanSample')
end
end
end
end