Permalink
Browse files

Repository test: use test repo

  • Loading branch information...
1 parent 34c43a9 commit 1bd5213c0e7c8e023bb53e5eb1f746d4917a6edd @ben ben committed Jun 22, 2013
Showing with 21 additions and 26 deletions.
  1. +21 −26 test/test.repository.coffee
@@ -4,40 +4,35 @@ gitteh = require "../lib/gitteh"
fixtures = require "./fixtures"
describe "Repository", ->
- describe "Using the project repo...", ->
+ describe "Using the test repo...", ->
repo = null
it "opens correctly", (done) ->
- gitteh.openRepository fixtures.projectRepo.path, (err, _repo) ->
+ gitteh.openRepository fixtures.testRepo.path, (err, _repo) ->
repo = _repo
repo.should.be.an.instanceof gitteh.Repository
done()
describe "#bare", ->
- it "should be false for this repo", ->
- repo.bare.should.be.false
+ it "should be true for this repo", ->
+ repo.bare.should.be.true
it "should be immutable", ->
repo.bare = 123
- repo.bare.should.be.false
+ repo.bare.should.be.true
delete repo.path
- repo.bare.should.be.false
+ repo.bare.should.be.true
describe "#path", ->
- it "should point to #{fixtures.projectRepo.gitPath}", ->
- repo.path.should.equal fixtures.projectRepo.gitPath
+ it "should point to #{fixtures.testRepo.path}", ->
+ repo.path.should.equal fixtures.testRepo.path
it "should be immutable", ->
repo.path = "foo"
- repo.path.should.equal fixtures.projectRepo.gitPath
+ repo.path.should.equal fixtures.testRepo.path
delete repo.path
- repo.path.should.equal fixtures.projectRepo.gitPath
+ repo.path.should.equal fixtures.testRepo.path
describe "#workingDirectory", ->
- it "should point to #{fixtures.projectRepo.path}", ->
- repo.workingDirectory.should.equal fixtures.projectRepo.path
- it "should be immutable", ->
- repo.path = "foo"
- repo.workingDirectory.should.equal fixtures.projectRepo.path
- delete repo.path
- repo.workingDirectory.should.equal fixtures.projectRepo.path
+ it "should be null", ->
+ should.not.exist repo.workingDirectory
describe "#exists()", ->
it "should return true for first commit in repo :)", (done) ->
- repo.exists "1f4425ce2a14f21b96b9c8dde5bcfd3733467b14", (err, exists) ->
+ repo.exists fixtures.testRepo.firstCommit.id, (err, exists) ->
exists.should.be.true
done()
it "should reject invalid oids", ->
@@ -52,42 +47,42 @@ describe "Repository", ->
).should.throw()
describe "#object()", ->
it "works for full OID", (done) ->
- repo.object "1f4425ce2a14f21b96b9c8dde5bcfd3733467b14", (err, obj) ->
+ repo.object fixtures.testRepo.secondCommit.id, (err, obj) ->
should.not.exist err
obj.should.be.an.instanceof gitteh.Commit
done()
it "works for shortened OID", (done) ->
- repo.object "1f4425ce2a", (err, obj) ->
+ repo.object fixtures.testRepo.secondCommit.id[..8], (err, obj) ->
should.not.exist err
obj.should.be.an.instanceof gitteh.Commit
done()
describe "#commit()", ->
it "works", (done) ->
- repo.commit "1f4425ce2a14f21b96b9c8dde5bcfd3733467b14", (err, obj) ->
+ repo.commit fixtures.testRepo.secondCommit.id, (err, obj) ->
should.not.exist err
obj.should.be.an.instanceof gitteh.Commit
done()
it "fails for objects that aren't a commit", (done) ->
- repo.commit fixtures.projectRepo.secondCommit.wscriptBlob, (err, obj) ->
+ repo.commit fixtures.testRepo.secondCommit.readmeBlob, (err, obj) ->
should.exist err
done()
describe "#tree()", ->
it "works", (done) ->
- repo.tree fixtures.projectRepo.secondCommit.tree, (err, obj) ->
+ repo.tree fixtures.testRepo.secondCommit.tree, (err, obj) ->
should.not.exist err
obj.should.be.an.instanceof gitteh.Tree
done()
it "fails for objects that aren't a tree", (done) ->
- repo.tree fixtures.projectRepo.secondCommit.id, (err, obj) ->
+ repo.tree fixtures.testRepo.secondCommit.id, (err, obj) ->
should.exist err
done()
describe "#blob()", ->
it "works", (done) ->
- repo.blob fixtures.projectRepo.secondCommit.wscriptBlob, (err, obj) ->
+ repo.blob fixtures.testRepo.secondCommit.readmeBlob, (err, obj) ->
should.not.exist err
obj.should.be.an.instanceof gitteh.Blob
done()
it "fails for objects that aren't a blob", (done) ->
- repo.blob fixtures.projectRepo.secondCommit.id, (err, obj) ->
+ repo.blob fixtures.testRepo.secondCommit.id, (err, obj) ->
should.exist err
done()

0 comments on commit 1bd5213

Please sign in to comment.