Skip to content

Commit

Permalink
Fix test failures with folder name collisions
Browse files Browse the repository at this point in the history
- Test folder is now only created when needed, and emptied.
- Testing creating folder with tilde now uses unique folder name.
  • Loading branch information
JohnSundell committed Jun 5, 2017
1 parent 227d9b0 commit 859a951
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Tests/FilesTests/FilesTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class FilesTests: XCTestCase {

override func setUp() {
super.setUp()
folder = try! Folder.home.createSubfolder(named: ".filesTest")
folder = try! Folder.home.createSubfolderIfNeeded(withName: ".filesTest")
try! folder.empty()
}

override func tearDown() {
Expand Down Expand Up @@ -505,8 +506,8 @@ class FilesTests: XCTestCase {
func testCreatingFolderWithTildePathFromFileSystem() {
performTest {
let fileSystem = FileSystem()
try fileSystem.createFolder(at: "~/.filestest")
let createdFolder = try fileSystem.homeFolder.subfolder(named: ".filestest")
try fileSystem.createFolder(at: "~/.filesTestFolder")
let createdFolder = try fileSystem.homeFolder.subfolder(named: ".filesTestFolder")

// Cleanup since we're performing a test in the actual home folder
try createdFolder.delete()
Expand Down

0 comments on commit 859a951

Please sign in to comment.