diff --git a/app/models/recurring_todo.rb b/app/models/recurring_todo.rb index 2f6d623b..4a916c6d 100644 --- a/app/models/recurring_todo.rb +++ b/app/models/recurring_todo.rb @@ -30,7 +30,6 @@ class RecurringTodo < ActiveRecord::Base validates_presence_of :description validates_presence_of :recurring_period validates_presence_of :target - validates_presence_of :recurring_period validates_presence_of :ends_on validates_presence_of :context diff --git a/test/fixtures/recurring_todos.yml b/test/fixtures/recurring_todos.yml index db630d68..9597d674 100644 --- a/test/fixtures/recurring_todos.yml +++ b/test/fixtures/recurring_todos.yml @@ -1,4 +1,3 @@ -<% def today Time.zone.now.beginning_of_day.to_s(:db) @@ -30,7 +29,7 @@ call_bill_gates_every_day: description: Call Bill Gates every day notes: ~ state: active - start_from: ~ + start_from: <%= last_week %> ends_on: no_end_date end_date: ~ number_of_occurences: ~ @@ -38,6 +37,7 @@ call_bill_gates_every_day: show_from_delta: ~ recurring_period: daily recurrence_selector: ~ + show_always: 0 every_other1: 1 every_other2: ~ every_other3: ~ @@ -62,6 +62,7 @@ call_bill_gates_every_workday: number_of_occurences: ~ target: due_date show_from_delta: ~ + show_always: 0 recurring_period: daily recurrence_selector: ~ every_other1: 1 @@ -82,7 +83,7 @@ call_bill_gates_every_week: description: Call Bill Gates every week notes: ~ state: active - start_from: ~ + start_from: <%= today %> ends_on: no_end_date end_date: ~ number_of_occurences: ~ @@ -90,6 +91,7 @@ call_bill_gates_every_week: show_from_delta: ~ recurring_period: weekly recurrence_selector: ~ + show_always: 0 every_other1: 2 every_other2: ~ every_other3: ~ @@ -108,7 +110,7 @@ check_with_bill_every_last_friday_of_month: description: Check with Bill every last friday of the month notes: ~ state: active - start_from: ~ + start_from: <%= today %> ends_on: no_end_date end_date: ~ number_of_occurences: ~ @@ -116,6 +118,7 @@ check_with_bill_every_last_friday_of_month: show_from_delta: 5 recurring_period: monthly recurrence_selector: 1 + show_always: 0 every_other1: 1 every_other2: 2 every_other3: 5 @@ -134,12 +137,13 @@ birthday_reinier: description: Congratulate Reinier on his birthday notes: ~ state: active - start_from: ~ + start_from: <%= today %> ends_on: no_end_date end_date: ~ number_of_occurences: ~ target: due_date show_from_delta: 5 + show_always: 0 recurring_period: yearly recurrence_selector: 0 every_other1: 8 diff --git a/test/functional/login_controller_test.rb b/test/functional/login_controller_test.rb index 50da6ae8..051bb744 100644 --- a/test/functional/login_controller_test.rb +++ b/test/functional/login_controller_test.rb @@ -51,7 +51,7 @@ class LoginControllerTest < ActionController::TestCase def test_login_with_no_users_redirects_to_signup User.delete_all get :login - assert_redirected_to :controller => 'users', :action => 'new' + assert_redirected_to signup_url end def test_logout diff --git a/test/functional/recurring_todos_controller_test.rb b/test/functional/recurring_todos_controller_test.rb index 394e72d7..ebe64ed0 100644 --- a/test/functional/recurring_todos_controller_test.rb +++ b/test/functional/recurring_todos_controller_test.rb @@ -50,6 +50,7 @@ class RecurringTodosControllerTest < ActionController::TestCase "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", @@ -110,6 +111,9 @@ class RecurringTodosControllerTest < ActionController::TestCase @yearly.every_other1 = target_date.day @yearly.every_other2 = target_date.month @yearly.show_from_delta = 10 +# unless @yearly.valid? +# @yearly.errors.each {|obj, error| puts error} +# end assert @yearly.save # toggle twice to force generation of new todo @@ -155,6 +159,7 @@ class RecurringTodosControllerTest < ActionController::TestCase "recurring_period"=>"yearly", "recurring_show_days_before"=>"0", "recurring_target"=>"due_date", + "recurring_show_always" => "1", "start_from"=>"1/10/2012", # adjust after 2012 "weekly_every_x_week"=>"1", "weekly_return_monday"=>"w", diff --git a/test/functional/todos_controller_test.rb b/test/functional/todos_controller_test.rb index 0035f291..ec93e728 100644 --- a/test/functional/todos_controller_test.rb +++ b/test/functional/todos_controller_test.rb @@ -376,12 +376,16 @@ class TodosControllerTest < ActionController::TestCase # change recurrence pattern to monthly and set show_from 2 days before due # date this forces the next todo to be put in the tickler recurring_todo_1.show_from_delta = 2 + recurring_todo_1.show_always = 0 + recurring_todo_1.target = 'due_date' recurring_todo_1.recurring_period = 'monthly' recurring_todo_1.recurrence_selector = 0 recurring_todo_1.every_other1 = 1 recurring_todo_1.every_other2 = 2 recurring_todo_1.every_other3 = 5 - recurring_todo_1.save + # use assert to catch validation errors if present. we need to replace + # this with a good factory implementation + assert recurring_todo_1.save # mark next_todo as complete by toggle_check xhr :post, :toggle_check, :id => next_todo.id, :_source_view => 'todo' @@ -416,7 +420,7 @@ class TodosControllerTest < ActionController::TestCase recurring_todo_1.recurrence_selector = 0 recurring_todo_1.every_other1 = today.day recurring_todo_1.every_other2 = 1 - recurring_todo_1.save + assert recurring_todo_1.save # mark todo_1 as complete by toggle_check, this gets rid of todo_1 that was # not correctly created from the adjusted recurring pattern we defined diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb index e53942cc..e20d9095 100644 --- a/test/functional/users_controller_test.rb +++ b/test/functional/users_controller_test.rb @@ -154,19 +154,19 @@ class UsersControllerTest < ActionController::TestCase def test_create_with_invalid_password_redirects_to_new_user_page login_as :admin_user post :create, :user => {:login => 'newbie', :password => '', :password_confirmation => ''} - assert_redirected_to :controller => 'users', :action => 'new' + assert_redirected_to signup_path end def test_create_with_invalid_login_does_not_add_a_new_user login_as :admin_user post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'} - assert_redirected_to :controller => 'users', :action => 'new' + assert_redirected_to signup_path end def test_create_with_invalid_login_redirects_to_new_user_page login_as :admin_user post :create, :user => {:login => 'n', :password => 'newbiepass', :password_confirmation => 'newbiepass'} - assert_redirected_to :controller => 'users', :action => 'new' + assert_redirected_to signup_path end def test_create_with_duplicate_login_does_not_add_a_new_user @@ -179,7 +179,7 @@ class UsersControllerTest < ActionController::TestCase def test_create_with_duplicate_login_redirects_to_new_user_page login_as :admin_user post :create, :user => {:login => 'jane', :password => 'newbiepass', :password_confirmation => 'newbiepass'} - assert_redirected_to :controller => 'users', :action => 'new' + assert_redirected_to signup_path end end