forked from facebook/react-native
/
FileUtilsMock.rb
39 lines (30 loc) · 901 Bytes
/
FileUtilsMock.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
module FileUtils
class FileUtilsStorage
@@RMRF_INVOCATION_COUNT = 0
@@RMRF_PATHS = []
def self.rmrf_invocation_count
return @@RMRF_INVOCATION_COUNT
end
def self.increase_rmrfi_invocation_count
@@RMRF_INVOCATION_COUNT += 1
end
def self.rmrf_paths
return @@RMRF_PATHS
end
def self.push_rmrf_path(path)
@@RMRF_PATHS.push(path)
end
def self.reset
@@RMRF_INVOCATION_COUNT = 0
@@RMRF_PATHS = []
end
end
def self.rm_rf(path)
FileUtilsStorage.push_rmrf_path(path)
FileUtilsStorage.increase_rmrfi_invocation_count
end
end