repository_test.rb revision 46dd7ca898be6d5dbdfda64fd90ce01e253c0878
require 'test_helper'
context "a repository" do
setup do
end
teardown do
end
context 'with a reserved name' do
should 'not be valid' do
end
end
context 'creating a permission' do
setup do
end
should 'with subject' do
end
should 'with role owner' do
end
end
context 'saving a file' do
setup do
@message = 'test message'
@content = "(Cat x)\n"
# create directory if it doesn't exist
end
# create file
end
should 'not have an ontology yet' do
end
context "that doesn't exist" do
setup do
end
should 'create the file in the git repository' do
end
should 'create the file with correct contents in the git repository' do
end
should 'create a new ontology with a default name' do
end
should 'create a new ontology with only one version pointing to the commit' do
end
should 'create a new ontology with only one version belonging to the right user' do
end
end
context 'that exists' do
setup do
end
teardown do
end
should 'create a new ontology version' do
end
end
end
context 'browsing the repository' do
setup do
@files = {
}
@message = 'test message'
@file_path_prefix = '/tmp/ontohub/test/git_repository/'
file_path = "#{@file_path_prefix}#{path}"
# create directory if it doesn't exist
end
# create file
end
end
teardown do
end
should 'list files and directories in the directories' do
end
assert_equal [{:type=>:dir, :name=>"folder1", :path=>"folder1", :index=>0, :ontology => false}], selected_entry
assert_equal([{:type=>:file, :name=>"file3.clf", :path=>"folder2/file3.clf", :index=>0, :ontology => true}], selected_entry)
end
should 'list files with given basename' do
expected = {
type: :file_base,
}
expected = {
type: :file_base_ambiguous,
entries: [
]
}
end
should 'have type file on exact filename' do
end
end
end
end
end
context 'an imported repository' do
context 'via git' do
setup do
@source_path = '/tmp/ontohub/test/unit/repository/repo'
@commit_count = 2
@commit_count.times do |n|
end
@repository = Repository.import_from_git(@user, "file://#{@source_path}", 'local import', description: 'just an imported repo')
end
teardown do
end
should 'be read_only' do
end
should 'have all the commits' do
end
should 'have source-type git' do
end
should 'have correct source address' do
end
should 'save the ontologies in the database' do
end
should 'save ontology versions in the database' do
@repository.ontologies.each do |o|
end
end
context 'getting synchronized' do
setup do
@commit_count.times do |n|
m = n+@commit_count
end
end
should 'get the new changes' do
end
context 'adding new ontologies' do
setup do
end
should 'save the ontologies in the database' do
end
should 'save ontology versions in the database' do
@repository.ontologies.each do |o|
end
end
end
end
end
context 'via svn' do
setup do
svn_server_name = 'server'
svn_client_name = 'client'
@url_svn_server = "file://#{@path_svn}/#{svn_server_name}"
@path_svn_client = "#{@path_svn}/#{svn_client_name}"
@commit_count = 2
stdin, stdout, stderr, wait_thr = Open3.popen3('bash', SCRIPT_SVN_CREATE_REPO, @path_svn, svn_server_name, svn_client_name)
stdin, stdout, stderr, wait_thr = Open3.popen3('bash', SCRIPT_SVN_ADD_COMMITS, @path_svn_client, "#{@commit_count}")
@repository = Repository.import_from_svn(@user, @url_svn_server, 'local svn clone', description: 'just a local svn clone')
end
teardown do
end
should 'be read_only' do
end
should 'have correct source type' do
end
should 'have correct source address' do
end
should 'be successful' do
end
end
end
end