File tree Expand file tree Collapse file tree
lib/overcommit/hook/commit_msg
spec/overcommit/hook/commit_msg Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ module Overcommit::Hook::CommitMsg
22 # Ensures commit message subject lines are followed by a blank line.
33 class SingleLineSubject < Base
44 def run
5+ return :pass if empty_message?
6+
57 unless commit_message_lines [ 1 ] . to_s . strip . empty?
68 return :warn , 'Subject should be one line and followed by a blank line'
79 end
Original file line number Diff line number Diff line change 77
88 before do
99 subject . stub ( :commit_message_lines ) . and_return ( commit_msg . split ( "\n " ) )
10+ subject . stub ( :empty_message? ) . and_return ( commit_msg . empty? )
11+ end
12+
13+ context 'when commit message is empty' do
14+ let ( :commit_msg ) { '' }
15+
16+ it { should pass }
1017 end
1118
1219 context 'when subject is separated from body by a blank line' do
You can’t perform that action at this time.
0 commit comments