git_repository_test.rb revision afd1d888784385307c9c0544597a513c2008d342
require 'test_helper'
# Tests a git repository
#
# Author: Eugen Kuksa <eugenk@informatik.uni-bremen.de>
context 'existing repository' do
setup do
@userinfo = {
time: Time.now
}
end
teardown do
@repository = nil
end
context 'getting the commit history' 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 'list all commits regarding the whole branch' do
@repository.commits.map{ |c| c[:oid] }
end
end
end
], @repository.commits(start_oid: @commit_change2, path: @filepath, stop_oid: @commit_delete1).map{ |c| c[:oid] }
end
end
], @repository.commits { |commit_oid| commit_oid }
end
end
end
end
end
setup do
@content1 = "Some\ncontent\nwith\nmany\nlines."
@content2 = "Some\ncontent,\nwith\nmany\nlines."
end
end
end
end
end
end
assert_equal @repository.changed_files(@commit1).first.mime_type, Mime::Type.lookup_by_extension(@file_extension)
end
end
end
end
end
end
end
assert_equal @repository.changed_files(@commit2).first.mime_type, Mime::Type.lookup_by_extension(@file_extension)
end
end
end
end
end
end
end
assert_equal @repository.changed_files.first.mime_type, Mime::Type.lookup_by_extension(@file_extension)
end
assert_equal @repository.changed_files.first.mime_category, 'application'
end
end
end
end
end