a previous commit introduced a bug where hiding a project did not hide the todos in it. Fixes #832

This commit is contained in:
Reinier Balt 2009-01-24 22:13:19 +01:00
parent 8076f4fe72
commit 07426ebe54
5 changed files with 25 additions and 31 deletions

View file

@ -94,7 +94,7 @@ class TodosControllerTest < Test::Rails::TestCase
assert_difference Todo, :count do
xml = "<todo><description>Call Warren Buffet to find out how much he makes per day</description><project_id>#{projects(:timemachine).id}</project_id><context_id>#{contexts(:agenda).id}</context_id><show-from type=\"datetime\">#{1.week.from_now.xmlschema}</show-from></todo>"
#p parse_xml_body(xml)
# p parse_xml_body(xml)
post :create, parse_xml_body(xml).update(:format => "xml")
assert_response :created
end
@ -505,4 +505,20 @@ class TodosControllerTest < Test::Rails::TestCase
assert next_todo.due > @todo.due
end
def test_removing_hidden_project_activates_todo
login_as(:admin_user)
# get a project and hide it, todos in the project should be hidden
p = projects(:timemachine)
p.hide!
assert p.reload().hidden?
todo = p.todos.first
assert "project_hidden", todo.state
# clear project from todo: the todo should be unhidden
xhr :post, :update, :id => 1, :_source_view => 'todo', "project_name"=>"None", "todo"=>{}
todo.reload()
assert "active", todo.state
end
end