mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 09:10:12 +01:00
add test to check if a new recurring todo ends up in the tickler
This commit is contained in:
parent
0f4a80d839
commit
eae4d0f6f1
1 changed files with 20 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ require 'todos_controller'
|
||||||
class TodosController; def rescue_action(e) raise e end; end
|
class TodosController; def rescue_action(e) raise e end; end
|
||||||
|
|
||||||
class TodosControllerTest < Test::Rails::TestCase
|
class TodosControllerTest < Test::Rails::TestCase
|
||||||
fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings
|
fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings, :recurring_todos
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@controller = TodosController.new
|
@controller = TodosController.new
|
||||||
|
|
@ -376,6 +376,24 @@ class TodosControllerTest < Test::Rails::TestCase
|
||||||
# check there is a new todo linked to the recurring pattern
|
# check there is a new todo linked to the recurring pattern
|
||||||
next_todo = Todo.find(:first, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'active'})
|
next_todo = Todo.find(:first, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'active'})
|
||||||
assert_equal "Call Bill Gates every day", next_todo.description
|
assert_equal "Call Bill Gates every day", next_todo.description
|
||||||
|
|
||||||
|
# change recurrence pattern to weekly and set show_from 2 days befor due date
|
||||||
|
# this forces the next todo to be put in the tickler
|
||||||
|
recurring_todo_1.show_from_delta = 2
|
||||||
|
recurring_todo_1.recurring_period = 'weekly'
|
||||||
|
recurring_todo_1.every_day = 'smtwtfs'
|
||||||
|
recurring_todo_1.save
|
||||||
|
|
||||||
|
# mark next_todo as complete by toggle_check
|
||||||
|
xhr :post, :toggle_check, :id => next_todo.id, :_source_view => 'todo'
|
||||||
|
next_todo.reload
|
||||||
|
assert next_todo.completed?
|
||||||
|
|
||||||
|
# check there is a new todo linked to the recurring pattern in the tickler
|
||||||
|
next_todo = Todo.find(:first, :conditions => {:recurring_todo_id => recurring_todo_1.id, :state => 'deferred'})
|
||||||
|
assert_equal "Call Bill Gates every day", next_todo.description
|
||||||
|
# check that the todo is in the tickler
|
||||||
|
assert !next_todo.show_from.nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue