Blanking out a project name when editing a todo will now remove the todo from the project.

Also fixed the reference to test/selenium_helper.rb in the test/environment.rb to be pathed more reliably.



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@487 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-03-28 04:45:39 +00:00
parent 02de36876e
commit 704d39add1
4 changed files with 19 additions and 2 deletions

View file

@ -124,7 +124,7 @@ class TodosController < ApplicationController
@original_item_context_id = @todo.context_id
@original_item_project_id = @todo.project_id
@original_item_was_deferred = @todo.deferred?
if params['todo']['project_id'].blank? && !params['project_name'].blank?
if params['todo']['project_id'].blank? && !params['project_name'].nil?
if params['project_name'] == 'None'
project = Project.null_object
else

View file

@ -24,5 +24,5 @@ config.action_mailer.delivery_method = :test
SALT = "change-me" unless defined?( SALT ).nil?
config.after_initialize do
require 'test/selenium_helper'
require File.expand_path(File.dirname(__FILE__) + "/../../test/selenium_helper")
end

View file

@ -105,6 +105,14 @@ class TodosControllerTest < Test::Unit::TestCase
actual = t.due
assert_equal expected, actual, "Expected #{expected.to_s(:db)}, was #{actual.to_s(:db)}"
end
def test_update_todos_with_blank_project_name
t = Todo.find(1)
@request.session['user_id'] = users(:admin_user).id
xhr :post, :update, :id => 1, :_source_view => 'todo', :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.reload
assert t.project.nil?
end
def test_update_todo_tags_to_none
t = Todo.find(1)

View file

@ -0,0 +1,9 @@
setup :fixtures => :all
login :as => 'admin'
open "/projects/Build_a_working_time_machine"
click "edit_icon_todo_5"
wait_for_element_present "show_from_todo_5"
type "project_name_todo_5", ""
click "//input[@value='Update']"
wait_for_element_not_present "todo_5"
assert_text 'badge_count', '1'