File tree 2 files changed +16
-6
lines changed
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def daemonize
33
33
unless Dir . singleton_methods . include? ( :exists? )
34
34
class Dir
35
35
def self . exists? ( file_name )
36
- warn ( ' exists? is a deprecated name , use exist? instead' )
36
+ warn ( "Dir. exists?(' #{ file_name } ') is deprecated, use Dir. exist? instead" ) if $VERBOSE
37
37
Dir . exist? ( file_name )
38
38
end
39
39
end
@@ -42,7 +42,7 @@ def self.exists?(file_name)
42
42
unless File . singleton_methods . include? ( :exists? )
43
43
class File
44
44
def self . exists? ( file_name )
45
- warn ( ' exists? is a deprecated name , use exist? instead' )
45
+ warn ( "File. exists?(' #{ file_name } ') is deprecated, use File. exist? instead" ) if $VERBOSE
46
46
File . exist? ( file_name )
47
47
end
48
48
end
Original file line number Diff line number Diff line change 14
14
15
15
if RUBY_VERSION >= '3.2'
16
16
it 'logs a warning message' do
17
- expect ( Dir ) . to receive ( :warn ) . with ( 'exists? is a deprecated name, use exist? instead' )
18
- Dir . exists? ( __dir__ )
17
+ expect ( Dir ) . to receive ( :warn ) . with ( "Dir.exists?('#{ __dir__ } ') is deprecated, use Dir.exist? instead" )
18
+ $VERBOSE = true
19
+ begin
20
+ Dir . exists? ( __dir__ )
21
+ rescue
22
+ $VERBOSE = nil
23
+ end
19
24
end
20
25
end
21
26
end
33
38
34
39
if RUBY_VERSION >= '3.2'
35
40
it 'logs a warning message' do
36
- expect ( File ) . to receive ( :warn ) . with ( 'exists? is a deprecated name, use exist? instead' )
37
- File . exists? ( __FILE__ )
41
+ expect ( File ) . to receive ( :warn ) . with ( "File.exists?('#{ __FILE__ } ') is deprecated, use File.exist? instead" )
42
+ $VERBOSE = true
43
+ begin
44
+ File . exists? ( __FILE__ )
45
+ ensure
46
+ $VERBOSE = nil
47
+ end
38
48
end
39
49
end
40
50
end
You can’t perform that action at this time.
0 commit comments