mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-27 03:06:11 +01:00
fix #1027. Several tests were broken because of the more strict validations on the recurring_todo model
This commit is contained in:
parent
92bb54bbf5
commit
cfc6d117b8
6 changed files with 25 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue