diff --git a/spec/test_hook_spec.rb b/spec/test_hook_spec.rb index 5d647a2..236279d 100644 --- a/spec/test_hook_spec.rb +++ b/spec/test_hook_spec.rb @@ -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) diff --git a/spec/test_spec.rb b/spec/test_spec.rb index 6951a2a..ce53719 100644 --- a/spec/test_spec.rb +++ b/spec/test_spec.rb @@ -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