Class: TestCreation

Inherits:
MiniTest::Unit::TestCase
  • Object
show all
Includes:
Dorkbox
Defined in:
lib/dorkbox_test.rb

Constant Summary

Constants included from Dorkbox

Dorkbox::CONFLICT_STRING, Dorkbox::DORKBOX_CONFIG_PATH, Dorkbox::DORKBOX_CRONTAB_COMMENT, Dorkbox::GITIGNORE

Instance Method Summary collapse

Methods included from Dorkbox

#align_client_ref_to_master, #cleanup_tracked, #configure_client_id, #connect, #create, #create_new_client_id, #enable_dorkbox_cronjob, #retrieve_client_id, #sync, #sync_tracked, #track

Instance Method Details

#test_connectObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/dorkbox_test.rb', line 28

def test_connect
  Dir.mktmpdir() { |remote_repo_dir|
    `git init --bare #{remote_repo_dir}`

    first_client_name = nil
    Dir.mktmpdir() { |first_repo_dir|
      Dir.chdir(first_repo_dir) {
        first_client_name = create(remote_repo_dir)
      }

      Dir.mktmpdir() { |second_repo_dir|
        Dir.chdir(second_repo_dir) {
          second_client_name = connect(remote_repo_dir)
          all_branches = c("git branch -a")
          assert(all_branches.include?(first_client_name))
          assert(all_branches.include?(second_client_name))
        }
      }
    }
  }
  cleanup_tracked()
end

#test_createObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dorkbox_test.rb', line 13

def test_create
  Dir.mktmpdir() { |remote_repo_dir|
    `git init --bare #{remote_repo_dir}`

    Dir.mktmpdir() { |local_dorkbox_repo_dir|
      Dir.chdir(local_dorkbox_repo_dir) {
        create(remote_repo_dir)
        assert(File.exists?(GITIGNORE))
      }
    }

  }
  cleanup_tracked()
end