File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
spec/lib/rex/image_source Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
describe Rex ::ImageSource ::Memory do
7
7
8
+ let ( :raw_data ) { "ABCDEFGHIJKLMNOP" }
9
+
10
+ subject do
11
+ described_class . new ( raw_data )
12
+ end
13
+
8
14
describe "#initialize" do
9
15
subject ( :memory_class ) do
10
16
described_class . allocate
11
17
end
18
+
19
+ it "initializes size to data length" do
20
+ memory_class . send ( :initialize , raw_data )
21
+ expect ( memory_class . size ) . to eq ( raw_data . length )
22
+ end
23
+
24
+ it "initializes file_offset to 0 by default" do
25
+ memory_class . send ( :initialize , raw_data )
26
+ expect ( memory_class . file_offset ) . to eq ( 0 )
27
+ end
28
+
29
+ context "when using nil as data" do
30
+ it "raises an error" do
31
+ expect { memory_class . send ( :initialize , nil ) } . to raise_error ( NoMethodError )
32
+ end
33
+ end
12
34
end
13
35
14
36
describe "#read" do
You can’t perform that action at this time.
0 commit comments