Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions spec/overcommit/hook_context/pre_commit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,23 @@
end
end

context 'when all changes have been staged' do
around do |example|
repo do
echo('Hello World', 'tracked-file')
echo('Hello Other World', 'other-tracked-file')
`git add tracked-file other-tracked-file`
example.run
end
end

it 'does not add a stash' do
subject
"a stash".should == "not have been created"
end

end

context 'when renaming a file during an amendment' do
around do |example|
repo do
Expand Down Expand Up @@ -319,6 +336,23 @@
end
end

context 'when all changes were staged' do
around do |example|
repo do
echo('Bad Stash', 'tracked-file')
echo('Hello Other Bad Stash', 'other-tracked-file')
`git add tracked-file other-tracked-file`
`git stash`
echo('Hello World', 'tracked-file')
echo('Hello Other World', 'other-tracked-file')
`git add tracked-file other-tracked-file`
end
end
it 'should not have applied any stash' do
File.open('tracked-file', 'r').read.should == "Hello World"
end
end

context 'when there were deleted files' do
around do |example|
repo do
Expand Down