Start major refactoring of recurring_todos. Started with creating new recurring todos.

All current and new tests pass
This commit is contained in:
Reinier Balt 2014-01-27 16:42:54 +01:00
parent 8e13059df1
commit 78c07d52b7
26 changed files with 1218 additions and 32 deletions

View file

@ -62,6 +62,52 @@ class RecurringTodosControllerTest < ActionController::TestCase
assert_equal orig_todo_count+1, Todo.count
end
def test_new_recurring_todo_handles_attribs_outside_rec_todo
login_as(:admin_user)
# check new rec todo is not there
assert_nil RecurringTodo.where(:description => "new recurring pattern").first
put :create,
"context_name"=>"library",
"project_name"=>"Build a working time machine",
"recurring_todo" =>
{
"daily_every_x_days"=>"1",
"daily_selector"=>"daily_every_x_day",
"description"=>"new recurring pattern",
"end_date" => "31/08/2010",
"ends_on" => "ends_on_end_date",
"monthly_day_of_week" => "1",
"monthly_every_x_day" => "18",
"monthly_every_x_month2" => "1",
"monthly_every_x_month" => "1",
"monthly_every_xth_day"=>"1",
"monthly_selector"=>"monthly_every_x_day",
"notes"=>"with some notes",
"number_of_occurences" => "",
"recurring_period"=>"yearly",
"recurring_show_days_before"=>"10",
"recurring_target"=>"due_date",
"recurring_show_always" => "1",
"start_from"=>"18/08/2008",
"weekly_every_x_week"=>"1",
"weekly_return_monday"=>"m",
"yearly_day_of_week"=>"1",
"yearly_every_x_day"=>"8",
"yearly_every_xth_day"=>"1",
"yearly_month_of_year2"=>"8",
"yearly_month_of_year"=>"6",
"yearly_selector"=>"yearly_every_x_day"
},
"tag_list"=>"one, two, three, four", :format => :js
new_rec_todo = RecurringTodo.where(:description => "new recurring pattern").first
assert_not_nil new_rec_todo
end
def test_recurring_todo_toggle_check
# the test fixtures did add recurring_todos but not the corresponding todos,
# so we check complete and uncheck to force creation of a todo from the