tracks/test/unit/project_from_todo_test.rb
Matt Rogers 883ea2b968 Move Project#create_from_todo to its own class
The point of this is to keep as many things out of the ActiveRecord
objects as possible and use them as just a thin database abstraction
layer.
2013-05-02 22:30:24 -05:00

22 lines
661 B
Ruby

require_relative '../test_helper'
require_relative '../../lib/project_from_todo'
class ProjectFromTodoTest < ActiveSupport::TestCase
fixtures :todos
def test_create_project_from_valid_todo
todo = todos(:upgrade_rails)
project = ProjectFromTodo.new(todo).create
assert_equal project.name, todo.description
assert_equal project.description, todo.notes
assert_equal project.default_context, todo.context
end
def test_invalid_project_from_invalid_todo
todo = todos(:upgrade_rails)
todo.description = ""
project = ProjectFromTodo.new(todo).create
assert_not_nil project
assert_equal false, project.valid?
end
end