mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
fix clearing show_from fails
caused by slightly different (better) workings of aasm
This commit is contained in:
parent
883ea2b968
commit
f891ee86fe
8 changed files with 80 additions and 32 deletions
|
|
@ -384,6 +384,28 @@ class TodosControllerTest < ActionController::TestCase
|
|||
assert_equal context.id, todo.reload.context.id, 'context of todo should be changed'
|
||||
end
|
||||
|
||||
def test_update_clearing_show_from_makes_todo_active
|
||||
t = Todo.find(1)
|
||||
t.show_from = "01/01/2030"
|
||||
assert t.deferred?
|
||||
login_as(:admin_user)
|
||||
xhr :post, :update, :id => 1, :_source_view => 'todo', "todo"=>{"show_from"=>""}, "tag_list"=>""
|
||||
t = Todo.find(1)
|
||||
assert t.active?
|
||||
assert_nil t.show_from
|
||||
end
|
||||
|
||||
def test_update_setting_show_from_makes_todo_deferred
|
||||
t = Todo.find(1)
|
||||
assert t.active?
|
||||
login_as(:admin_user)
|
||||
xhr :post, :update, :id => 1, :_source_view => 'todo', "todo"=>{"show_from"=>"01/01/2030"}, "tag_list"=>""
|
||||
t = Todo.find(1)
|
||||
assert t.deferred?
|
||||
assert_not_nil t.show_from
|
||||
end
|
||||
|
||||
|
||||
#######
|
||||
# feeds
|
||||
#######
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
|
||||
first_todo = @moremoney.todos[0]
|
||||
first_todo.show_from = Time.zone.now + 1.week
|
||||
first_todo.save!
|
||||
assert_equal :deferred, @moremoney.todos[0].aasm_current_state
|
||||
|
||||
assert_equal 1, @moremoney.todos.deferred.count
|
||||
|
|
@ -219,8 +220,8 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
|
||||
p.activate!
|
||||
p.todos.each{|t| t.complete!}
|
||||
assert p.todos.active.empty?, "project should not have active todos"
|
||||
assert p.todos.deferred_or_blocked.empty?, "there should not be deferred or blocked todos"
|
||||
assert p.todos.reload.active.empty?, "project should not have active todos"
|
||||
assert p.todos.reload.deferred_or_blocked.empty?, "there should not be deferred or blocked todos"
|
||||
assert p.reload.stalled?, "project should be stalled"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue