##// END OF EJS Templates
Replace Date.today with User.current.today (#22320)....
Replace Date.today with User.current.today (#22320). Depending on the offset between a user's configured timezone and the server timezone, Date.today may be more or less often wrong from the user's perspective, leading to things like issues marked as overdue too early or too late, or yesterday / tomorrow being displayed / selected where 'today' is intended. A test case illustrating the problem with Issue#overdue? is included Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@15379 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r14856:cda9c63d9c21
r14997:ed50d42210ea
Show More
document_test.rb
69 lines | 2.5 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
Jean-Philippe Lang
Updates copyright for 2016....
r14856 # Copyright (C) 2006-2016 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
Toshi MARUYAMA
add missing fixtures to test/unit/document_test.rb...
r10030 fixtures :projects, :enumerations, :documents, :attachments,
:enabled_modules,
Jean-Philippe Lang
Add support for multiple email addresses per user (#4244)....
r13504 :users, :email_addresses, :members, :member_roles, :roles,
Toshi MARUYAMA
add missing fixtures to test/unit/document_test.rb...
r10030 :groups_users
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
Jean-Philippe Lang
Raises 60-character limit for document titles to 255 (#12312)....
r13879
def test_create_with_long_title
title = 'x'*255
doc = Document.new(:project => Project.find(1), :title => title, :category => DocumentCategory.first)
assert_save doc
assert_equal title, doc.reload.title
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
Jean-Philippe Lang
Tests should not change settings....
r9766
with_settings :notified_events => %w(document_added) do
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save
end
Eric Davis
Added observers to watch model objects for mail delivery instead of calling Mailer....
r2548 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