git_repository_test.rb revision 1b3a30e097b49e2c7a8d09b5d4cf544c1fec299b
require 'test_helper'
# Tests a git repository
#
# Author: Eugen Kuksa <eugenk@informatik.uni-bremen.de>
context 'creating and deleting a repository' do
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
@content = 'Some content'
@message = 'Some commit message'
assert_equal @repository.get_file(nil, 'path/file.txt')[:mime_type], Mime::Type.lookup('text/plain')
# 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
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 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 '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
end
context 'getting the history of a file' do
setup do
@commit_other1 = @repository.commit_file(@userinfo, 'Other content1', 'file2.txt', 'Other File: Add')
@commit_other2 = @repository.commit_file(@userinfo, 'Other content2', 'file2.txt', 'Other File: Change1')
@commit_other3 = @repository.commit_file(@userinfo, 'Other content3', 'file2.txt', 'Other File: Change2')
end
should 'have the correct values in the history at the HEAD' do
]
end
should 'have the correct values in the history a commit before the HEAD' do
]
end
should 'have the correct values in the history in the commit that changes another file' do
]
end
end
context 'getting the list of changed files' do
setup do
@content1 = "Some\ncontent\nwith\nmany\nlines."
@content2 = "Some\ncontent,\nwith\nmany\nlines."
end
should 'last commit be HEAD' do
end
should 'have the right file count when using the first commit' do
end
should 'have the right name in the list when using the first commit' do
end
should 'have the right path in the list when using the first commit' do
end
should 'have the right type in the list when using the first commit' do
end
should 'have the right mime type in the list when using the first commit' do
assert_equal @repository.get_changed_files(@commit1).first[:mime_type], Mime::Type.lookup_by_extension(@file_extension)
end
should 'have the right mime category in the list when using the first commit' do
end
should 'have the right editable in the list when using the first commit' do
end
should 'have the right file count when using a commit in the middle' do
end
should 'have the right name in the list when using a commit in the middle' do
end
should 'have the right path in the list when using a commit in the middle' do
end
should 'have the right type in the list when using a commit in the middle' do
end
should 'have the right mime type in the list when using a commit in the middle' do
assert_equal @repository.get_changed_files(@commit2).first[:mime_type], Mime::Type.lookup_by_extension(@file_extension)
end
should 'have the right mime category in the list when using a commit in the middle' do
end
should 'have the right editable in the list when using a commit in the middle' do
end
should 'have the right file count when using the HEAD' do
end
should 'have the right name in the list when using the HEAD' do
end
should 'have the right path in the list when using the HEAD' do
end
should 'have the right type in the list when using the HEAD' do
end
should 'have the right mime type in the list when using the HEAD' do
assert_equal @repository.get_changed_files.first[:mime_type], Mime::Type.lookup_by_extension(@file_extension)
end
should 'have the right mime category in the list when using the HEAD' do
end
should 'have the right editable in the list when using the HEAD' do
end
end
end
end