Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jan 09, 2012
@jfredett jfredett wip a39e59a
Showing with 35 additions and 4 deletions.
  1. +15 −2 lib/percival/clock/plugin.rb
  2. +20 −2 spec/clock_plugin_spec.rb
View
17 lib/percival/clock/plugin.rb
@@ -3,16 +3,29 @@ class ClockPlugin
match /clock (.+)/
- def execute(irc, status)
+ def execute(irc, subcommand, *args)
begin
- case status
+
+ case subcommand
+
when "in"
Clock.new.clock_in(irc.user)
when "out"
Clock.new.clock_out(irc.user)
+ when "summary"
+ subsubcommand = args.shift
+ case subsubcommand
+ when '--'
+ summary_create(*args)
+ when '--since'
+ summary_since(Date.parse(args.shift))
+ else
+ summary_since(1.week.ago)
+ end
else
irc.reply "USAGE: !clock <in|out>"
end
+
rescue InvalidTimesheetSequence
irc.reply "You are already clocked #{status}."
end
View
22 spec/clock_plugin_spec.rb
@@ -1,6 +1,5 @@
require 'spec_helper'
-
describe "The Clock plugin" do
let(:channel) do
IrcFaker.new(cinch_mock)
@@ -46,10 +45,29 @@
channel.
plugins(plugin_instance).
- send_message("!clock WRONG").
+ send_message("!clock wrong").
+ as("test_user").
+ run!
+ end
+
+ it "stores what I worked on when I tell it `!clock summary -- <some summary>`" do
+ pending "wip"
+ subject.should_receive(:clock_summary_create).with('this is a summary')
+
+ channel.
+ plugins(plugin_instance).
+ send_message("!clock summary -- this is a summary").
as("test_user").
run!
end
+
+ it "should print out a summary of what I worked on for the last week when I tell it `!clock summary`" do
+ pending
+ end
+
+ it "should print out a summary of what I worked on going back to the given date when I tell it `!clock summary --since <some date>`" do
+ pending
+ end
end
context "The class itself" do

No commit comments for this range

Something went wrong with that request. Please try again.