Sha256: 7a9f8e373c3e5fce4bc380d3cee859b0bfdc3e2aeb1b53cb99755a849f448f6f

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

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

describe 'Track files by index' do

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

  context 'repository with untracked files' do
    before (:each) do
      create 'untracked-1'
      create 'untracked-2'

      git.status[0].work_tree_status.should == :untracked
      git.status[1].work_tree_status.should == :untracked
    end

    context 'when a single file is tracked' do
      it 'should run git add for the file' do
        subject.track 1

        git.status[0].index_status.should == :added
        git.status[1].index_status.should == :untracked
      end
    end

    context 'when multiple files are tracked' do
      it 'should run git add for all specified files' do
        subject.track 1, 2

        git.status.each { |entry| entry.index_status.should == :added }
      end
    end
  end

  context 'when the repository contains no untracked files' do
    it 'should fail' do
      expect { subject.track 1 }.to raise_error
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.6 spec/git-shizzle/builtin_commands/track_spec.rb