 				done()
 
 		describe "symlink", ->
+			beforeEach ->
+				@fs.lstat = sinon.stub().callsArgWith(1, null, {
+					isFile:=> false
+					isDirectory:-> return false
+				})
+
 			it "should not read file if it is symlink", (done)->
-				@isSafeOnFileSystem = false
 				@handler.uploadFileFromDisk @project_id, @file_id, @fsPath, =>
 					@fs.createReadStream.called.should.equal false
 					done()

	describe "uploadFileFromDisk", ->
		beforeEach ->
			@request.returns(@writeStream)
			@isSafeOnFileSystem = true

		it "should create read stream", (done)->
			@fs.createReadStream.returns

		@fs =
			createReadStream : sinon.stub()
			lstat: sinon.stub().callsArgWith(1, null, {
				isFile:=> true
				isDirectory:-> return false
			})
		@writeStream =
