Verify error messages

This commit is contained in:
Sven Weidauer 2022-06-06 11:50:57 +02:00
parent 95633bfd9f
commit 3c7bfbc437
2 changed files with 6 additions and 2 deletions

View file

@ -15,7 +15,9 @@ describe 'Test Hook' do
end
it 'fails with a #fail line' do
expect { run '#fail' }.to raise_error
expect { run '#fail' }.to raise_error(RuntimeError) { |error|
expect(error.message).to eq('Cannot run test_hook.rb')
}
end
def run(input)

View file

@ -123,7 +123,9 @@ describe FormatStaged do
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
expect { repo.run_formatter }.to raise_error(RuntimeError) { |error|
expect(error.message).to eq 'Error formatting test.test'
}
end
it 'leaves files alone when write is false' do