Sha256: 15119adabc4aa9322c98ba4f22d1b0fcef10387bf1c1e7b256837fd924153b58
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
require 'git_shizzle' describe 'Diff 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(/diff/, anything) end context 'when a modified file is diffed' do it 'should run git diff' do subject.diff 2 expect(git).to have_received(:command).with('diff --', ['modified']) end end context 'when a deleted file is diffed' do it 'should run git diff' do subject.diff 1 expect(git).to have_received(:command).with('diff --', ['deleted']) end end end describe 'repository without modified files' do it 'should fail' do expect { subject.diff 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/diff_spec.rb |