Skip to content
Browse files

Show info about a ticket.

  • Loading branch information...
1 parent dfca475 commit 5caec92042caee032173105efd87975ad507d5d6 @alloy alloy committed
Showing with 13 additions and 0 deletions.
  1. +5 −0 lib/macruby_bugmash_bot.rb
  2. +4 −0 lib/macruby_bugmash_bot/trac.rb
  3. +4 −0 spec/trac_spec.rb
View
5 lib/macruby_bugmash_bot.rb
@@ -14,6 +14,7 @@
end
HELP = [
+ "‘#<id>’ Get info about a ticket.",
"‘!gimme’ This command will tell you of a single ticket that is available.",
"‘!work <id>’ This command tells the bot that you are now working on a ticket.",
"‘!stop <id>’ This command tells the bot that you are no longer working on a ticket.",
@@ -32,6 +33,10 @@
m.reply @trac.open_ticket
end
+ on :channel, /^#(\d+)/ do |m, id|
+ m.reply @trac.ticket_info(id, m.user.nick)
+ end
+
on :channel, /^!work (\d+)/ do |m, id|
m.reply @trac.assign_ticket(id, m.user.nick)
end
View
4 lib/macruby_bugmash_bot/trac.rb
@@ -57,6 +57,10 @@ def open_ticket
end
end
+ define_ticket_method :ticket_info do |_, ticket, __|
+ ticket_message(ticket)
+ end
+
define_ticket_method :assign_ticket do |id, ticket, user|
if assigned_to = DB.ticket_user(id)
if assigned_to[:name] == user
View
4 spec/trac_spec.rb
@@ -43,6 +43,10 @@ def self.raw_open_tickets_feed
@trac.ticket(105)[:summary].should == "#105: BridgeSupport can't convert KCGSessionEventTap as an argument for CGEventTapCreate"
end
+ it "returns info about a ticket" do
+ @trac.ticket_info("19", "alloy").should == "#19: Problems with method_missing (http://www.macruby.org/trac/ticket/19)"
+ end
+
it "returns a ticket that nobody is working on yet, in ascending ID order" do
@trac.assign_ticket("19", "alloy")
100.times do

0 comments on commit 5caec92

Please sign in to comment.
Something went wrong with that request. Please try again.