blob: 3a9fa8c7113fe35cc4eed5af96524aeae8851d06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
require 'spec_helper'
require Rails.root.join("db", "post_migrate", "20170717111152_cleanup_move_system_upload_folder_symlink.rb")
describe CleanupMoveSystemUploadFolderSymlink do
let(:migration) { described_class.new }
let(:test_base) { File.join(Rails.root, 'tmp', 'tests', 'move-system-upload-folder') }
let(:test_folder) { File.join(test_base, '-', 'system') }
before do
allow(migration).to receive(:base_directory).and_return(test_base)
FileUtils.rm_rf(test_base)
FileUtils.mkdir_p(test_folder)
allow(migration).to receive(:say)
end
describe '#up' do
before do
FileUtils.ln_s(test_folder, File.join(test_base, 'system'))
end
it 'removes the symlink' do
migration.up
expect(File.exist?(File.join(test_base, 'system'))).to be_falsey
end
end
describe '#down' do
it 'creates the symlink' do
migration.down
expect(File.symlink?(File.join(test_base, 'system'))).to be_truthy
end
end
end
|