Add specs for Rex::ImageSource::Memory#initialize

bug/bundler_fix
jvazquez-r7 2014-09-22 11:02:24 -05:00
parent a249eb1026
commit 77122895db
1 changed files with 22 additions and 0 deletions

View File

@ -5,10 +5,32 @@ require 'rex/image_source/memory'
describe Rex::ImageSource::Memory do
let(:raw_data) { "ABCDEFGHIJKLMNOP"}
subject do
described_class.new(raw_data)
end
describe "#initialize" do
subject(:memory_class) do
described_class.allocate
end
it "initializes size to data length" do
memory_class.send(:initialize, raw_data)
expect(memory_class.size).to eq(raw_data.length)
end
it "initializes file_offset to 0 by default" do
memory_class.send(:initialize, raw_data)
expect(memory_class.file_offset).to eq(0)
end
context "when using nil as data" do
it "raises an error" do
expect { memory_class.send(:initialize, nil) }.to raise_error(NoMethodError)
end
end
end
describe "#read" do