Sha256: c0cd87f2d5377c2e463b7dce226e082a3cb0de2eb2cac1920d18e92ce97a54e2

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

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'

      expect(git.status.count).to eq(1)
    end
  end

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

      expect(git.status.count).to eq(1)
    end
  end

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

      expect(git.status.count).to eq(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

        expect(git.status.count).to eq(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'

        expect(git.status.count).to eq(2)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.8 spec/git_shizzle/status_parser_spec.rb