1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00
gift/test/status.test.coffee

67 lines
2.0 KiB
CoffeeScript
Raw Normal View History

2012-02-15 15:51:45 +01:00
should = require 'should'
fixtures = require './fixtures'
git = require '../src'
Status = require '../src/status'
GIT_STATUS = """
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: crackers.txt
# modified: file.txt
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: cheese.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# pickles.txt
"""
2012-03-23 15:58:50 +01:00
GIT_STATUS_CLEAN = """
# On branch master
# nothing to commit (working directory clean)
"""
2012-02-15 15:51:45 +01:00
describe "Status", ->
describe "()", ->
2012-03-23 15:58:50 +01:00
describe "when there are no changes", ->
repo = fixtures.status
status = new Status.Status repo
status.parse GIT_STATUS_CLEAN
it "is clean", ->
status.clean.should.be.true
2012-02-15 15:51:45 +01:00
describe "when there are changes", ->
repo = fixtures.status
status = new Status.Status repo
status.parse GIT_STATUS
it "has a modified staged file", ->
status.files["file.txt"].staged.should.be.true
status.files["file.txt"].type.should.eql "M"
status.files["file.txt"].tracked.should.be.true
it "has a modified unstaged file", ->
status.files["cheese.txt"].staged.should.be.false
status.files["cheese.txt"].type.should.eql "M"
status.files["cheese.txt"].tracked.should.be.true
it "has a deleted file", ->
status.files["crackers.txt"].staged.should.be.true
status.files["crackers.txt"].type.should.eql "D"
status.files["crackers.txt"].tracked.should.be.true
it "has an untracked file", ->
status.files["pickles.txt"].tracked.should.be.false
should.not.exist status.files["pickles.txt"].type
it "is not clean", ->
status.clean.should.be.false