git_repository_test.rb revision 5377dc644918632ef318825466e4f3cd861e27ec
require 'test_helper'
# Tests a git repository
#
# Author: Eugen Kuksa <eugenk@informatik.uni-bremen.de>
context 'creating and deleting a repository' do
setup do
end
teardown do
@repository = nil
end
should 'create repository' do
@path_new = "#{@path}_new"
end
should 'delete repository' do
@path_new = "#{@path}_new"
end
end
context 'existing repository' do
setup do
@userinfo = {
time: Time.now
}
end
teardown do
@repository = nil
end
context 'using files' do
setup do
@content = 'Some content'
@message = 'Some commit message'
end
should 'create single commit of a file' do
# removed because of time zone issues
#assert_equal Time.at(@repository.commit_author[:time]), Time.gm(@userinfo[:time])
end
should 'delete a file' do
end
should 'overwrite a file' do
content2 = "#{@content}_2"
message2 = "#{@message}_2"
end
should 'have test if path points through a file' do
folder = "folder/1"
fullpath = "#{folder}/#{@filepath}"
end
should 'throw Exception on erroneous paths' do
end
end
should 'reset state on empty repository with failing commit block' do
end
end
# it is actually empty, but in this test this can't be found out
#assert @repository.empty?
end
should 'reset state with failing commit block' do
end
end
# it is actually equal, but in this test this can't be found out
#assert_equal first_commit_oid, @repository.head_oid
end
end
context 'using folders' do
setup do
@subfolder = 'path'
@content = 'Some content'
@message1 = 'Some commit message1'
@message2 = 'Some commit message2'
@message3 = 'Some commit message3'
end
should 'read the right number of contents in the root folder after adding the first file' do
end
should 'read the right contents in the root folder after adding the first file' do
type: :dir,
}]
end
should 'read the right number of contents in the subfolder after adding the first file' do
end
should 'read the right contents in the subfolder after adding the first file' do
type: :file,
}]
end
should 'read the right number of contents in the root folder after adding the second file' do
end
should 'read the right contents in the root folder after adding the second file' do
type: :dir,
}]
end
should 'read the right number of contents in the subfolder after adding the second file' do
end
should 'read the right contents in the subfolder after adding the second file' do
type: :file,
},{
type: :file,
}]
end
should 'read the right number of contents in the root folder after adding the third file' do
end
should 'read the right contents in the root folder after adding the third file' do
type: :dir,
},{
type: :file,
}]
end
should 'read the right number of contents in the subfolder after adding the third file' do
end
should 'read the right contents in the subfolder after adding the third file' do
type: :file,
},{
type: :file,
}]
end
should 'treat path "/" and empty path equally' do
assert_equal @repository.folder_contents(@commit_add3, '/'), @repository.folder_contents(@commit_add3)
assert_equal @repository.folder_contents(@commit_add3, '/'), @repository.folder_contents(@commit_add3, nil)
end
should 'read the right number of contents in the root folder after deleting the first file' do
end
should 'read the right contents in the root folder after deleting the first file' do
type: :dir,
},{
type: :file,
}]
end
should 'read the right number of contents in the subfolder after deleting the first file' do
end
should 'read the right contents in the subfolder after deleting the first file' do
type: :file,
}]
end
should 'read the right number of contents in the root folder after deleting the second file' do
end
should 'read the right contents in the root folder after deleting the second file' do
type: :file,
}]
end
should 'read the right number of contents in the root folder after deleting the third file' do
end
should 'read the right contents in the root folder after deleting the third file' do
end
should 'process all files by files method' do
files = []
@repository.files do |entry|
end
assert_equal [], files
end
[@filepath1, @commit_add1],
[@filepath2, @commit_add2],
end
end
end
end