all non-cucumber tests are passing

This commit is contained in:
Reinier Balt 2012-04-27 14:22:16 +02:00
parent 13b58f3a10
commit 63175c115b
46 changed files with 248 additions and 505 deletions

View file

@ -1,9 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'todos_controller'
require 'recurring_todos_controller'
class RecurringTodosTest < ActionController::IntegrationTest
fixtures :users, :preferences, :projects, :contexts, :todos, :tags, :taggings, :recurring_todos
def logs_in_as(user,plain_pass)
@user = user
@ -16,22 +13,21 @@ class RecurringTodosTest < ActionController::IntegrationTest
assert_template "todos/index"
end
def test_deleting_recurring_todo_clears_reference_from_related_todos
logs_in_as(users(:admin_user), 'abracadabra')
rt = RecurringTodo.find(1)
assert !rt.nil? # given there is a recurring todo
assert rt.todos.size, 1 # and it has one todos referencing it
assert_equal 1, rt.todos.size # and it has one todo referencing it
# when I toggle the todo complete
todo = Todo.find_by_recurring_todo_id(1)
post "/todos/toggle_check/#{todo.id}", :_source_view => 'todo'
put "/todos/#{todo.id}/toggle_check", :_source_view => 'todo'
todo.reload
assert todo.completed?
rt.reload # then there should be two todos referencing
assert rt.todos.size, 2
assert_equal 2, rt.todos.size
todo2 = Todo.find(:first, :conditions => {:recurring_todo_id => rt.id, :state => 'active'})
assert_not_equal todo2.id, todo.id # and the todos should be different