##// END OF EJS Templates
When copying issues, let the status be changed to default or left unchanged....
When copying issues, let the status be changed to default or left unchanged. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9404 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r5728:9831c27fd0b1
r9270:09375960d69d
Show More
document_test.rb
58 lines | 2.1 KiB | text/x-ruby | RubyLexer
/ test / unit / document_test.rb
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 # Redmine - project management software
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728 # Copyright (C) 2006-2011 Jean-Philippe Lang
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 #
# 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.
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728 #
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 # 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.
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728 #
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 # 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.
Jean-Baptiste Barth
Use absolute paths in test/**/* requires for Ruby 1.9.2 compatibility. #4050...
r4395 require File.expand_path('../../test_helper', __FILE__)
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122
Eric Davis
Upgraded to Rails 2.3.4 (#3597)...
r2773 class DocumentTest < ActiveSupport::TestCase
Jean-Philippe Lang
Show last update datetime (last attachment added) on document list (#4232)....
r2981 fixtures :projects, :enumerations, :documents, :attachments
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122
def test_create
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save
end
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728
Eric Davis
Added observers to watch model objects for mail delivery instead of calling Mailer....
r2548 def test_create_should_send_email_notification
ActionMailer::Base.deliveries.clear
Setting.notified_events << 'document_added'
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save
assert_equal 1, ActionMailer::Base.deliveries.size
end
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 def test_create_with_default_category
# Sets a default category
e = Enumeration.find_by_name('Technical documentation')
e.update_attributes(:is_default => true)
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 doc = Document.new(:project => Project.find(1), :title => 'New document')
assert_equal e, doc.category
assert doc.save
end
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728
Jean-Philippe Lang
Show last update datetime (last attachment added) on document list (#4232)....
r2981 def test_updated_on_with_attachments
d = Document.find(1)
assert d.attachments.any?
assert_equal d.attachments.map(&:created_on).max, d.updated_on
end
Toshi MARUYAMA
remove trailing white-spaces from unit document test....
r5728
Jean-Philippe Lang
Show last update datetime (last attachment added) on document list (#4232)....
r2981 def test_updated_on_without_attachments
d = Document.find(2)
assert d.attachments.empty?
assert_equal d.created_on, d.updated_on
end
Jean-Philippe Lang
Fixed: default category ignored when adding a document (#2328)....
r2122 end