Commit ed0a8a8f by John Doe

working on metadata updates

parent d8ed8a7f
...@@ -39,5 +39,4 @@ RSpec.describe 'DbFile' do ...@@ -39,5 +39,4 @@ RSpec.describe 'DbFile' do
expect(db_service).to have_received(:remove_file) expect(db_service).to have_received(:remove_file)
end end
end end
end end
...@@ -164,12 +164,57 @@ describe 'UpdateDb' do ...@@ -164,12 +164,57 @@ describe 'UpdateDb' do
# ...and the service should have a warning # ...and the service should have a warning
expect(@service.warnings?).to be true expect(@service.warnings?).to be true
end end
it 'adds new files' it 'adds new files' do
it 'adds new folders' # create Db with 1 folder and file
update_with_schema([helper.entry('/folder1/old_file')])
@folder = @root.subfolders.first
expect(@folder.db_files.count).to eq(1)
# run update again with a new file added
update_with_schema([helper.entry('/folder1/old_file'),
helper.entry('/folder1/new_file')],
db: @db)
expect(@folder.db_files.count).to eq(2)
end
it 'adds new folders' do
# create Db with 1 folder and file
update_with_schema([helper.entry('/folder1/old_file')])
@folder = @root.subfolders.first
expect(@folder.subfolders.count).to eq(0)
# run update again with a new file added
update_with_schema([helper.entry('/folder1/old_file'),
helper.entry('/folder1/new_folder/info')],
db: @db)
expect(@folder.subfolders.count).to eq(1)
end
end end
describe 'given changes to remote metadata' do describe 'given changes to remote metadata' do
it 'updates file info' it 'updates file info' do
it 'updates folder info' # create Db with 1 folder and file
update_with_schema([helper.entry('/folder1/file1',
metadata: { name: 'old_name' })])
file = DbFile.find_by_name('old_name')
expect(file).to be_present
# run update again with new metadata
update_with_schema([helper.entry('/folder1/file1',
metadata: { name: 'new_name' })],
db: @db)
file.reload
expect(file.name).to eq('new_name')
end
it 'updates folder info' do
# create Db with folder and subfolder
update_with_schema([helper.entry('/folder1/subfolder/info',
metadata: { name: 'old_name' })])
folder = DbFolder.find_by_name('old_name')
expect(folder).to be_present
# run update again with new metadata
update_with_schema([helper.entry('/folder1/subfolder/info',
metadata: { name: 'new_name' })],
db: @db)
folder.reload
expect(folder.name).to eq('new_name')
end
it 'adds new streams' it 'adds new streams'
it 'removes missing streams' it 'removes missing streams'
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment