Update java_deserializer specs

bug/bundler_fix
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 end
context "when file contains a valid stream" do context "when file contains a valid stream" do
it "prints the stream contents" do before(:each) do
expect(File).to receive(:new) do $stdout.string = ''
contents = valid_stream end
StringIO.new(contents)
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 end
deserializer.file = 'sample'
deserializer.run
expect($stdout.string).to include('[7e0001] NewArray { char, ["97", "98"] }')
end end
end end
@ -69,6 +87,5 @@ describe JavaDeserializer do
expect($stdout.string).to include('[-] Failed to unserialize Stream') expect($stdout.string).to include('[-] Failed to unserialize Stream')
end end
end end
end end
end end