From 84e49c451cf6fabbf838b3ebeea3a56680bc7f05 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 26 Apr 2013 23:07:49 -0500 Subject: [PATCH] add a test for the TodosController#calendar --- test/functional/todos_controller_test.rb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index 1a3f92fc..1e7afa75 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -898,4 +898,28 @@ class TodosControllerTest < ActionController::TestCase assert t4.predecessors.map(&:id).include?(t3.id) end + + def test_calendar + login_as(:admin_user) + + get :calendar + + projects = [projects(:timemachine), + projects(:moremoney), + projects(:gardenclean)] + due_today = [todos(:phone_grandfather), + todos(:call_bill_gates_every_day), + todos(:due_today)] + due_next_week = [todos(:buy_shares), + todos(:buy_stego_bait), + todos(:new_action_in_context)] + + assert_equal "calendar", assigns['source_view'] + assert_equal projects, assigns['projects'] + assert_equal due_today, assigns['due_today'] + assert_equal [], assigns['due_this_week'] + assert_equal due_next_week, assigns['due_next_week'] + assert_equal [], assigns['due_this_month'] + assert_equal 8, assigns['count'] + end end