Skip to content
Permalink
Browse files

All users to be unassigned.

This was always part of the plan, but it never got tested or implemented properly. Hopefully the distribution will be more random now.
  • Loading branch information...
lazyatom committed Nov 14, 2011
1 parent 8334f09 commit d4f0925026456e3da07cd3ca7107cf411516c9a3
Showing with 24 additions and 1 deletion.
  1. +5 −0 config/schedule.rb
  2. +4 −0 lib/harmonia.rb
  3. +1 −1 lib/harmonia/administrator.rb
  4. +14 −0 test/administrator_test.rb
@@ -6,6 +6,11 @@
job_type :unassign, %{#{harmonia_run} "Harmonia.new.unassign(::task)"}
job_type :remind, %{#{harmonia_run} "Harmonia.new.remind(::task)"}

every :monday, :at => "11.59am" do
unassign :invoices
unassign :weeknotes
end

every :monday, :at => "12:00pm" do
assign :invoices
assign :weeknotes
@@ -23,6 +23,10 @@ def remind(task)
dispatch_reminder_mail_for_task(task, assignee)
end

def unassign(task)
@administrator.unassign(task)
end

private

def dispatch_mail_for_task(task, assignee)
@@ -26,7 +26,7 @@ def assignee(task)
end

def unassign(task)
@assigned.delete(:task)
@assigned.delete(task)
write_store
end

@@ -24,6 +24,20 @@ def test_should_reset_the_assignee_when_assigning_again
assert_equal person_2, @administrator.assignee(:task_a)
end

def test_should_be_able_to_unassign_a_task
@administrator.assign(:task_a)
@administrator.unassign(:task_a)
assert_equal nil, @administrator.assignee(:task_a)
end

def test_should_be_able_to_unassign_everyone
@administrator.assign(:task_a)
@administrator.assign(:task_b)
@administrator.reset!
assert_equal nil, @administrator.assignee(:task_a)
assert_equal nil, @administrator.assignee(:task_b)
end

def test_should_not_assign_the_same_person_to_two_tasks
100.times do
person_1 = @administrator.assign(:task_a)

0 comments on commit d4f0925

Please sign in to comment.
You can’t perform that action at this time.