Add specs for Rex::Java::Serialization::Builder#add_specs

bug/bundler_fix
jvazquez-r7 2015-01-20 15:13:30 -06:00
parent d4a8049ac5
commit 7d43ec7f93
1 changed files with 38 additions and 1 deletions

View File

@ -26,6 +26,13 @@ describe Rex::Java::Serialization::Builder do
}
end
let(:array_opts) do
{
values_type: 'byte',
values: [0x41, 0x42, 0x43, 0x44]
}
end
describe ".new" do
it "returns a Rex::Java::Serialization::Builder" do
expect(builder).to be_a(Rex::Java::Serialization::Builder)
@ -94,7 +101,7 @@ describe Rex::Java::Serialization::Builder do
end
context "when options" do
it "returns a Rex::Java::Serialization::Model::NewClassDesc" do
it "returns a Rex::Java::Serialization::Model::NewObject" do
expect(builder.new_object(object_opts)).to be_a(Rex::Java::Serialization::Model::NewObject)
end
@ -103,4 +110,34 @@ describe Rex::Java::Serialization::Builder do
end
end
end
describe "#new_array" do
context "when no options" do
it "returns a Rex::Java::Serialization::Model::NewArray" do
expect(builder.new_array).to be_a(Rex::Java::Serialization::Model::NewArray)
end
it "sets empty values type" do
expect(builder.new_array.type).to eq('')
end
it "sets empty values array" do
expect(builder.new_array.values).to eq([])
end
end
context "when options" do
it "returns a Rex::Java::Serialization::Model::NewArray" do
expect(builder.new_array(array_opts)).to be_a(Rex::Java::Serialization::Model::NewArray)
end
it "sets empty values type" do
expect(builder.new_array(array_opts).type).to eq(array_opts[:values_type])
end
it "sets empty values array" do
expect(builder.new_array(array_opts).values).to eq(array_opts[:values])
end
end
end
end