From 229c515e711ecd29a7e8b026b35a0913d8ce8e1b Mon Sep 17 00:00:00 2001 From: Carsten Otto Date: Sun, 12 Apr 2015 21:57:23 +0200 Subject: [PATCH] retain tags from action when transforming into project --- lib/project_from_todo.rb | 1 + test/models/project_from_todo_test.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/project_from_todo.rb b/lib/project_from_todo.rb index db91030b..871a487b 100644 --- a/lib/project_from_todo.rb +++ b/lib/project_from_todo.rb @@ -21,6 +21,7 @@ class ProjectFromTodo p.name = todo.description p.description = todo.notes p.default_context = todo.context + p.default_tags = todo.tag_list p.user = todo.user end end diff --git a/test/models/project_from_todo_test.rb b/test/models/project_from_todo_test.rb index b2d0bd24..77d2efb8 100644 --- a/test/models/project_from_todo_test.rb +++ b/test/models/project_from_todo_test.rb @@ -12,6 +12,13 @@ class ProjectFromTodoTest < ActiveSupport::TestCase assert_equal project.default_context, todo.context end + def test_retain_tags_from_todo + todo = todos(:upgrade_rails) + todo.tag_with "a, b" + project = ProjectFromTodo.new(todo).create + assert_equal "a, b", project.default_tags + end + def test_invalid_project_from_invalid_todo todo = todos(:upgrade_rails) todo.description = ""