Add file storage

This commit is contained in:
2019-11-04 21:58:28 +03:00
parent 41176c7a1f
commit 73ed1eca06
4 changed files with 82 additions and 25 deletions

View File

@ -1,2 +1,25 @@
require "spec"
require "../src/dayoff/**"
def d(day)
location = Time::Location.load("Europe/Moscow")
Time.local(2019, 1, day, location: location)
end
def t(day, hour, min = 0)
location = Time::Location.load("Europe/Moscow")
Time.local(2019, 1, day, hour, min, location: location)
end
def with_temp_dir(&block)
tmpdir = File.tempname("dayoff_file_storage")
Dir.mkdir tmpdir
begin
yield tmpdir
ensure
Dir.glob(tmpdir + "/*") do |f|
File.delete f
end
Dir.rmdir tmpdir
end
end