Sha256: cb69c5e61e37cac7bf25bcb0b9a343a70ca1efce027e4e702b979b7e929bd76e

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

require 'git_shizzle'

describe 'Stage patches by index', :draft => true do

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

  before do
    allow($stdout).to receive(:puts)
  end

  describe 'repository with modified files' do
    before do
      %w{ deleted modified }.each { |f| create f; stage f }
      `git commit --message Blah`

      delete 'deleted'
      modify 'modified'

      expect(git.status[0].work_tree_status).to eq(:deleted)
      expect(git.status[1].work_tree_status).to eq(:modified)
    end

    before do
      allow(git).to receive(:command).and_call_original
      allow(git).to receive(:command).with(/add/, anything)
    end

    context 'when a modified file is staged' do
      it 'should run git add --patch' do
        subject.stage_with_patch 2

        expect(git).to have_received(:command).with('add --patch --', ['modified'])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.8 spec/git_shizzle/builtin_commands/stage_patch_spec.rb