Permalink
Browse files

GitCommit messages should be supplied by a hook on github.

  • Loading branch information...
spraints committed Jan 18, 2012
1 parent 58aac87 commit 68a65fe41f6f9981a78fe2086da038b1a281c76b
Showing with 13 additions and 4 deletions.
  1. +8 −4 lib/campfire_notifier.rb
  2. +5 −0 spec/lib/campfire_notifier_spec.rb
View
@@ -27,6 +27,8 @@ def message_for(params)
"Task #{resource[:task_id]} is blocked! \"#{resource[:blocking_message]}\" #{url_for resource[:task_id]}"
when 'Column'
"Column \"#{resource[:name]}\" modified."
+ when 'GitCommit'
+ return false
else
"#{resource[:type].humanize}. #{url_for resource[:task_id]}"
end
@@ -37,10 +39,12 @@ def url_for task_id
end
def say message
- if KanbfireConfig.no_campfire
- Rails.logger.info "MESSAGE FOR CAMPFIRE: #{message}"
- else
- campfire_room.speak message
+ if message
+ if KanbfireConfig.no_campfire
+ Rails.logger.info "MESSAGE FOR CAMPFIRE: #{message}"
+ else
+ campfire_room.speak message
+ end
end
end
@@ -37,6 +37,11 @@
it { should == '[kanbanery] Column "My Column" modified.' }
end
+ context 'Gitcommit' do
+ let(:resource) { { "id"=>"4784", "created_at"=>"2012-01-18T19:16:14+00:00", "updated_at"=>"2012-01-18T19:16:14+00:00","commit_id"=>"a1b2c37890abcdef1234567890abcdef12345678","message"=>"Commit message. #12345","url"=>"https://github.com/spraints/kanbfire/commit/a1b2c37890abcdef1234567890abcdef12345678","author_email"=>"author@example.com","author_name"=>"Author Name","timestamp"=>"2012-01-18T19:16:08+00:00","task_id"=>"12345","short_commit_id"=>"a1b2c3","gravatar_url"=>"https://secure.gravatar.com/avatar/example?s=10","type"=>"GitCommit" } }
+ it { should == false }
+ end
+
context 'unknown event type' do
let(:resource) { { "type" => "Something_Else" } }
it { should == '[kanbanery] Something else. ' }

0 comments on commit 68a65fe

Please sign in to comment.