From 159c0ac25b20d736dd0c6c03bb17bcb44986a0e0 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Mon, 6 Jun 2022 11:32:59 +0200 Subject: [PATCH] Verify that a failing formatter fails the whole process --- spec/test_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/test_spec.rb b/spec/test_spec.rb index 54edcb2..5ebb9e2 100644 --- a/spec/test_spec.rb +++ b/spec/test_spec.rb @@ -119,4 +119,10 @@ describe FormatStaged do expect(repo.get_content('test.test')).to eq('#clear') expect(repo.get_content('other.test')).to eq('a = b') end + + it 'fails if the hook returns a nonzero status' do + repo.set_content 'test.test', '#fail' + repo.stage 'test.test' + expect { repo.run_formatter }.to raise_error + end end