mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-22 16:56:10 +01:00
Remove 'project_hidden' state
Compute it using project/context state Notable change: todo.hidden? now also returns true if the todo is completed
This commit is contained in:
parent
543f49ed8a
commit
ed3bca22a4
12 changed files with 66 additions and 106 deletions
|
|
@ -13,7 +13,17 @@ class ContextsControllerTest < ActionController::TestCase
|
|||
get :show, { :id => "1" }
|
||||
assert_equal 'TRACKS::Context: agenda', assigns['page_title']
|
||||
end
|
||||
|
||||
|
||||
def test_shows_todos_when_hidden
|
||||
c = contexts(:agenda)
|
||||
todos = c.todos.active
|
||||
assert_equal 6, todos.size
|
||||
c.hide!
|
||||
login_as :admin_user
|
||||
get :show, { :id => '1'}
|
||||
assert_equal 6, assigns['not_done_todos'].size
|
||||
end
|
||||
|
||||
def test_show_renders_show_template
|
||||
login_as :admin_user
|
||||
get :show, { :id => "1" }
|
||||
|
|
|
|||
|
|
@ -52,13 +52,13 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
assert_ajax_create_increments_count 'My New Project'
|
||||
end
|
||||
|
||||
def test_todo_state_is_project_hidden_after_hiding_project
|
||||
def test_todo_is_hidden_after_hiding_project
|
||||
p = projects(:timemachine)
|
||||
todos = p.todos.active
|
||||
login_as(:admin_user)
|
||||
xhr :post, :update, :id => 1, "project"=>{"name"=>p.name, "description"=>p.description, "state"=>"hidden"}
|
||||
todos.each do |t|
|
||||
assert_equal :project_hidden, t.reload().aasm.current_state
|
||||
assert t.reload().hidden?
|
||||
end
|
||||
assert p.reload().hidden?
|
||||
end
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert p.reload().hidden?
|
||||
todo = p.todos.first
|
||||
|
||||
assert todo.project_hidden?, "todo should be project_hidden"
|
||||
assert todo.hidden?, 'todo should be hidden'
|
||||
|
||||
# clear project from todo: the todo should be unhidden
|
||||
xhr :post, :update, :id => todo.id, :_source_view => 'todo', "project_name"=>"", "todo"=>{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue