expandDir.file("file2").assertContents(equalTo("contents of file2"));
}
@Test
public void createsBzip2CompressedTarFile() {
final TestFile tarFile = tmpDir.getDir().file("test.tbz2");
context.checking(new Expectations(){{
allowing(copyAction).getArchivePath();
will(returnValue(tarFile));
allowing(copyAction).getCompression();
will(returnValue(Compression.BZIP2));
}});
visitor.startVisit(copyAction);
visitor.visitSpec(copySpec);
visitor.visitFile(file("dir/file1"));
visitor.visitFile(file("file2"));
visitor.endVisit();
TestFile expandDir = tmpDir.getDir().file("expanded");
tarFile.untarTo(expandDir);
expandDir.file("dir/file1").assertContents(equalTo("contents of dir/file1"));
expandDir.file("file2").assertContents(equalTo("contents of file2"));
}