Sha256: ee3a7abed100d8492ede17da0ce6880019029303ff80f9c90b4a5f7fdaf9d91a
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require 'git_shizzle' describe 'Checkout files by index' 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(/checkout/, anything) end context 'when a modified file is checked out' do it 'should run git checkout' do subject.checkout 2 expect(git).to have_received(:command).with('checkout --', ['modified']) end end context 'when a deleted file is checked out' do it 'should run git checkout' do subject.checkout 1 expect(git).to have_received(:command).with('checkout --', ['deleted']) end end end describe 'repository without modified files' do it 'should fail' do expect { subject.checkout 1 }.to raise_error 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/checkout_spec.rb |