Sha256: 9194cb38b0628ff2518280a751f86ce12f5560939c1607be051df1506ab402f2

Contents?: true

Size: 1.39 KB

Versions: 1

Compression:

Stored size: 1.39 KB

Contents

require File.join(File.dirname(__FILE__), '../spec_helper')
require 'git_shizzle'

describe 'File index, status and path parsed from `git status`' do

  let(:git) { GitShizzle::Git::Git.new(repo) }
  subject { GitShizzle::QuickGit.new(git) }

  context 'when file name does not contain spaces' do
    it 'should be able to parse' do
      create 'file-name'

      git.status.count.should == 1
    end
  end

  context 'when file name contains spaces' do
    it 'should be able to parse' do
      create 'file name'

      git.status.count.should == 1
    end
  end

  context 'when two files are untracked' do
    it 'should be able to parse' do
      create 'file-1'
      create 'file-2'

      git.status.count.should == 2
    end
  end

  context 'when tracked file was renamed and staged' do
    context 'no other files exist' do
      it 'should be able to parse indexes' do
        create 'file'
        stage
        `git commit -m 'added file'`
        move 'file', 'renamed-file'
        stage

        git.status.count.should == 1
      end
    end

    context 'untracked files exist' do
      it 'should be able to parse indexes' do
        create 'file'
        stage
        `git commit -m 'added file'`
        move 'file', 'renamed-file'
        stage
        create 'untracked'

        git.status.count.should == 2
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.6 spec/git-shizzle/status_parser_spec.rb