3
3
describe PuppetForge ::Tar ::Mini do
4
4
let ( :entry_class ) do
5
5
Class . new do
6
- attr_accessor :typeflag , :name
7
- def initialize ( name , typeflag )
6
+ attr_accessor :typeflag , :name , :full_name
7
+ def initialize ( name , full_name , typeflag )
8
8
@name = name
9
+ @full_name = full_name
9
10
@typeflag = typeflag
10
11
end
11
12
end
@@ -15,9 +16,9 @@ def initialize(name, typeflag)
15
16
let ( :sourcedir ) { '/the/src/dir' }
16
17
let ( :destfile ) { '/the/dest/file.tar.gz' }
17
18
let ( :minitar ) { described_class . new }
18
- let ( :tarfile_contents ) { [ entry_class . new ( 'file' , '0' ) , \
19
- entry_class . new ( 'symlink' , '2' ) , \
20
- entry_class . new ( 'invalid' , 'F' ) ] }
19
+ let ( :tarfile_contents ) { [ entry_class . new ( 'file' , 'full_file' , ' 0') , \
20
+ entry_class . new ( 'symlink' , 'full_symlink' , ' 2') , \
21
+ entry_class . new ( 'invalid' , 'full_invalid' , ' F') ] }
21
22
22
23
it "unpacks a tar file" do
23
24
unpacks_the_entry ( :file_start , 'thefile' )
@@ -66,13 +67,15 @@ def initialize(name, typeflag)
66
67
67
68
expect ( Zlib ::GzipReader ) . to receive ( :open ) . with ( sourcefile ) . and_yield ( reader )
68
69
expect ( Archive ::Tar ::Minitar ) . to receive ( :open ) . with ( reader ) . and_return ( tarfile_contents )
69
- expect ( Archive ::Tar ::Minitar ) . to receive ( :unpack ) . with ( reader , destdir , [ 'file' ] ) . and_yield ( :file_start , 'thefile' , nil )
70
-
70
+ #expect(Archive::Tar::Minitar).to receive(:unpack).with(reader, destdir, ['file']).and_yield(:file_start, 'thefile', nil)
71
+
72
+ expect ( Archive ::Tar ::Minitar ) . to receive ( :unpack ) . with ( reader , destdir , [ 'full_file' ] ) . and_yield ( :file_start , 'thefile' , nil )
73
+
71
74
file_lists = minitar . unpack ( sourcefile , destdir )
72
75
73
- expect ( file_lists [ :valid ] ) . to eq ( [ 'file ' ] )
74
- expect ( file_lists [ :invalid ] ) . to eq ( [ 'invalid ' ] )
75
- expect ( file_lists [ :symlinks ] ) . to eq ( [ 'symlink ' ] )
76
+ expect ( file_lists [ :valid ] ) . to eq ( [ 'full_file ' ] )
77
+ expect ( file_lists [ :invalid ] ) . to eq ( [ 'full_invalid ' ] )
78
+ expect ( file_lists [ :symlinks ] ) . to eq ( [ 'full_symlink ' ] )
76
79
end
77
80
78
81
def unpacks_the_entry ( type , name )
0 commit comments