mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 22:46:22 +02:00
fix tests
This commit is contained in:
parent
0fe20bd63b
commit
3b594cf30d
10 changed files with 388 additions and 1664 deletions
11
config/initializers/file_exists_alias.rb
Normal file
11
config/initializers/file_exists_alias.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
# В Ruby метод File.exist? является основным, а File.exists? - устаревшим алиасом.
|
||||
# Однако в некоторых тестах или библиотеках может использоваться именно File.exists?.
|
||||
# Этот инициализатор добавляет алиас, чтобы оба метода работали корректно.
|
||||
|
||||
if !File.respond_to?(:exist?) && File.respond_to?(:exists?)
|
||||
# Если exist? не определен, но exists? определен - добавляем алиас exist? -> exists?
|
||||
File.singleton_class.send(:alias_method, :exist?, :exists?)
|
||||
elsif !File.respond_to?(:exists?) && File.respond_to?(:exist?)
|
||||
# Если exists? не определен, но exist? определен - добавляем алиас exists? -> exist?
|
||||
File.singleton_class.send(:alias_method, :exists?, :exist?)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue