Update java_deserializer specs

This commit is contained in:
jvazquez-r7 2015-01-22 14:50:48 -06:00
parent 5c413a8102
commit 720def9d0a
1 changed files with 25 additions and 8 deletions

View File

@ -47,14 +47,32 @@ describe JavaDeserializer do
end
context "when file contains a valid stream" do
it "prints the stream contents" do
expect(File).to receive(:new) do
contents = valid_stream
StringIO.new(contents)
before(:each) do
$stdout.string = ''
end
context "when no options" do
it "prints the stream contents" do
expect(File).to receive(:new) do
contents = valid_stream
StringIO.new(contents)
end
deserializer.file = 'sample'
deserializer.run
expect($stdout.string).to include('[7e0001] NewArray { char, ["97", "98"] }')
end
end
context "when :array in options" do
it "prints the array contents" do
expect(File).to receive(:new) do
contents = valid_stream
StringIO.new(contents)
end
deserializer.file = 'sample'
deserializer.run({:array => '0'})
expect($stdout.string).to include('Array Type: char')
end
deserializer.file = 'sample'
deserializer.run
expect($stdout.string).to include('[7e0001] NewArray { char, ["97", "98"] }')
end
end
@ -69,6 +87,5 @@ describe JavaDeserializer do
expect($stdout.string).to include('[-] Failed to unserialize Stream')
end
end
end
end