replace 'None' project by empty string, fix #440

This commit is contained in:
Carsten Otto 2015-05-10 14:08:20 +02:00
parent d7944c2464
commit a29009d3da
8 changed files with 10 additions and 12 deletions

View file

@ -319,10 +319,10 @@ class TodosControllerTest < ActionController::TestCase
assert_equal 1, t.project_id
end
def test_update_todo_project_to_none
def test_update_todo_delete_project
t = Todo.find(1)
login_as(:admin_user)
xhr :post, :update, :id => 1, :_source_view => 'todo', "context_name"=>"library", "project_name"=>"None", "todo"=>{"id"=>"1", "notes"=>"", "description"=>"Call Warren Buffet to find out how much he makes per day", "due"=>"30/11/2006"}, "tag_list"=>"foo bar"
xhr :post, :update, :id => 1, :_source_view => 'todo', "context_name"=>"library", "project_name"=>"", "todo"=>{"id"=>"1", "notes"=>"", "description"=>"Call Warren Buffet to find out how much he makes per day", "due"=>"30/11/2006"}, "tag_list"=>"foo bar"
t = Todo.find(1)
assert_nil t.project_id
end
@ -384,7 +384,7 @@ class TodosControllerTest < ActionController::TestCase
assert todo.project_hidden?, "todo should be project_hidden"
# clear project from todo: the todo should be unhidden
xhr :post, :update, :id => todo.id, :_source_view => 'todo', "project_name"=>"None", "todo"=>{}
xhr :post, :update, :id => todo.id, :_source_view => 'todo', "project_name"=>"", "todo"=>{}
assert assigns['project_changed'], "the project of the todo should be changed"
todo = Todo.find(todo.id) # reload does not seem to work anymore

View file

@ -55,8 +55,8 @@ class AttributeHandlerTest < ActiveSupport::TestCase
h[:project_name] = "A project"
assert h.project_specified_by_name?, "project is specified by name"
h[:project_name] = "None"
assert !h.project_specified_by_name?, "None is special token to specify nil-project"
h[:project_name] = ""
assert !h.project_specified_by_name?, "Blank string is special token to specify nil-project"
end
def test_context_specified_by_name

View file

@ -102,8 +102,8 @@ class TodoCreateParamsHelperTest < ActiveSupport::TestCase
assert_equal false, params_helper.project_specified_by_name?
end
def test_project_specified_by_name_is_false_when_project_name_is_none
params = ActionController::Parameters.new({ 'project_name' => 'None', 'todo' => {} })
def test_project_specified_by_name_is_false_when_project_name_is_blank_string
params = ActionController::Parameters.new({ 'project_name' => '', 'todo' => {} })
params_helper = Todos::TodoCreateParamsHelper.new(params, users(:admin_user))
assert_equal false, params_helper.project_specified_by_name?
end