2019-04-29 20:27:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-10-11 05:41:23 -04:00
|
|
|
require 'rails_helper'
|
2015-04-06 23:03:43 -04:00
|
|
|
require 'letter_avatar'
|
|
|
|
|
|
|
|
describe LetterAvatar do
|
|
|
|
it "can cleanup correctly" do
|
|
|
|
path = LetterAvatar.cache_path
|
|
|
|
|
|
|
|
FileUtils.mkdir_p(path + "junk")
|
|
|
|
LetterAvatar.generate("test", 100)
|
|
|
|
|
|
|
|
LetterAvatar.cleanup_old
|
|
|
|
|
2015-04-25 11:18:35 -04:00
|
|
|
expect(Dir.entries(File.dirname(path)).length).to eq(3)
|
2015-04-06 23:03:43 -04:00
|
|
|
end
|
|
|
|
end
|