Merged r2119 to r2127 from trunk.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.8-stable@2133 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-12-14 15:32:11 +00:00
parent 633e026e44
commit 0a709660d2
21 changed files with 208 additions and 96 deletions
@@ -32,10 +32,19 @@ class DocumentsControllerTest < Test::Unit::TestCase
end
def test_index
# Sets a default category
e = Enumeration.find_by_name('Technical documentation')
e.update_attributes(:is_default => true)
get :index, :project_id => 'ecookbook'
assert_response :success
assert_template 'index'
assert_not_nil assigns(:grouped)
# Default category selected in the new document form
assert_tag :select, :attributes => {:name => 'document[category_id]'},
:child => {:tag => 'option', :attributes => {:selected => 'selected'},
:content => 'Technical documentation'}
end
def test_new_with_one_attachment
+1 -1
View File
@@ -44,7 +44,7 @@ class AccountTest < ActionController::IntegrationTest
assert_response :success
assert_template "account/lost_password"
post "account/lost_password", :mail => 'jsmith@somenet.foo'
post "account/lost_password", :mail => 'jSmith@somenet.foo'
assert_redirected_to "account/login"
token = Token.find(:first)
+37
View File
@@ -0,0 +1,37 @@
# Redmine - project management software
# Copyright (C) 2006-2008 Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require File.dirname(__FILE__) + '/../test_helper'
class DocumentTest < Test::Unit::TestCase
fixtures :projects, :enumerations, :documents
def test_create
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save
end
def test_create_with_default_category
# Sets a default category
e = Enumeration.find_by_name('Technical documentation')
e.update_attributes(:is_default => true)
doc = Document.new(:project => Project.find(1), :title => 'New document')
assert_equal e, doc.category
assert doc.save
end
end
+37
View File
@@ -37,6 +37,43 @@ class EnumerationTest < Test::Unit::TestCase
assert !Enumeration.find(7).in_use?
end
def test_default
e = Enumeration.default('IPRI')
assert e.is_a?(Enumeration)
assert e.is_default?
assert_equal 'Normal', e.name
end
def test_create
e = Enumeration.new(:opt => 'IPRI', :name => 'Very urgent', :is_default => false)
assert e.save
assert_equal 'Normal', Enumeration.default('IPRI').name
end
def test_create_as_default
e = Enumeration.new(:opt => 'IPRI', :name => 'Very urgent', :is_default => true)
assert e.save
assert_equal e, Enumeration.default('IPRI')
end
def test_update_default
e = Enumeration.default('IPRI')
e.update_attributes(:name => 'Changed', :is_default => true)
assert_equal e, Enumeration.default('IPRI')
end
def test_update_default_to_non_default
e = Enumeration.default('IPRI')
e.update_attributes(:name => 'Changed', :is_default => false)
assert_nil Enumeration.default('IPRI')
end
def test_change_default
e = Enumeration.find_by_name('Urgent')
e.update_attributes(:name => 'Urgent', :is_default => true)
assert_equal e, Enumeration.default('IPRI')
end
def test_destroy_with_reassign
Enumeration.find(4).destroy(Enumeration.find(6))
assert_nil Issue.find(:first, :conditions => {:priority_id => 4})
+6
View File
@@ -158,4 +158,10 @@ class UserTest < Test::Unit::TestCase
@jsmith.pref.comments_sorting = 'desc'
assert @jsmith.wants_comments_in_reverse_order?
end
def test_find_by_mail_should_be_case_insensitive
u = User.find_by_mail('JSmith@somenet.foo')
assert_not_nil u
assert_equal 'jsmith@somenet.foo', u.mail
end
end