mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
speed up reloader specs
This commit is contained in:
parent
3e3f05863a
commit
4a1c2f8cb1
1 changed files with 3 additions and 4 deletions
|
@ -61,10 +61,9 @@ describe Sinatra::Reloader do
|
|||
# needed to change the file's mtime.
|
||||
def update_file(path, &block)
|
||||
original_mtime = File.exist?(path) ? File.mtime(path) : Time.at(0)
|
||||
begin
|
||||
new_time = original_mtime + 1
|
||||
File.open(path, 'w', &block)
|
||||
sleep 0.1
|
||||
end until original_mtime != File.mtime(path)
|
||||
File.utime(new_time, new_time, path)
|
||||
end
|
||||
|
||||
# Writes a Sinatra application to a file, requires the file, sets
|
||||
|
|
Loading…
Reference in a new issue