Compare commits

..
50 Commits
Author SHA1 Message Date
Jean-Philippe Lang 54eecf54ff tagged version 1.4.5
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/tags/1.4.5@10835 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-11-17 13:25:19 +00:00
Jean-Philippe Lang 628e63eefe Updates for 1.4.5 release.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10834 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-11-17 13:24:56 +00:00
Toshi MARUYAMA 83b356484a Merged r10709 from trunk to 1.4-stable (#12196)
fix "Page not found" on OK button in SCM "View all revisions" page.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10711 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-24 10:33:15 +00:00
Toshi MARUYAMA 5210b58226 Merged r10702 from trunk to 1.4-stable (#12189)
add tmp/pdf directory.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10704 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-23 11:01:49 +00:00
Toshi MARUYAMA a0932173a5 Merged r10689 from trunk to 1.4-stable
Partial backout r10263.

Backout replacing shoulda context of test/unit/helpers/issues_helper_test.rb.
Test methods in shoulda context do not run on Ruby 1.8.7-p370.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10693 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-22 03:29:14 +00:00
Toshi MARUYAMA e889fe9c8a Merged r10688 from trunk to 1.4-stable
Backout r10253.

Backout replacing shoulda context of test/unit/helpers/issues_helper_test.rb.
Test methods in shoulda context do not run on Ruby 1.8.7-p370.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10692 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-22 03:28:44 +00:00
Toshi MARUYAMA 16b1fcb079 Merged r10596 from trunk to 1.4-stable (#9732)
German translation updated by Raphael Kallensee.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10601 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-11 03:55:38 +00:00
Toshi MARUYAMA 3b7793561a Merged r10572 from trunk
add missing fixtures to test/unit/issue_relation_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10579 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-09 11:58:27 +00:00
Toshi MARUYAMA 2c3c1d2a02 Merged r10571 from trunk
add missing fixture to test/integration/api_test/issues_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10578 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-10-09 11:58:13 +00:00
Toshi MARUYAMA 49cb3aaca6 Merged r10503 from trunk to 1.4-stable (#11966)
add functional test of sub repository diff path.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10508 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-28 04:48:01 +00:00
Toshi MARUYAMA 8a8df72937 Merged r10502 from trunk to 1.4-stable (#11966)
add functional test of main repository diff path.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10507 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-28 04:47:46 +00:00
Toshi MARUYAMA ad238abd0c Merged r10490 from trunk to 1.4-stable (#11966)
explicitly define route at scm diff view.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10506 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-28 04:47:26 +00:00
Toshi MARUYAMA d69cae859f Merged r10501 from trunk
set user preference diff type nil at functional tests.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10504 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-28 03:51:33 +00:00
Toshi MARUYAMA 59d4d210a7 Merged r10498 from trunk
scm: git: use with_settings instead of assigned setting at functional test

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10500 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-28 00:19:09 +00:00
Toshi MARUYAMA 633b86236c Merged r10477 from trunk
set default_language en at test_commit_closing_a_subproject_issue of unit changeset test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10483 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-26 12:05:51 +00:00
Toshi MARUYAMA 91514dd682 add tests that i18n currency options are nil to 1.4-stable Rails2 (#11922)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10475 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-26 08:12:04 +00:00
Jean-Philippe Lang 917127f179 Updated 1.4 CHANGELOG.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10300 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-06 17:25:29 +00:00
Jean-Philippe Lang 49295481de Add namespace to Time (#11298).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10299 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-06 17:23:57 +00:00
Jean-Philippe Lang 8cc56cce66 Merged r10294 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10297 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-06 17:21:09 +00:00
Jean-Philippe Lang 8d5fadc773 Updated 1.4 CHANGELOG.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10296 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-06 17:19:27 +00:00
Jean-Philippe Lang eb3e79b70d Merged r10148 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10295 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-06 17:07:49 +00:00
Toshi MARUYAMA 5d3bdb66cd Merged r10253, r10257, r10263 and r10264 from trunk to 1.4-stable
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10266 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 07:22:52 +00:00
Toshi MARUYAMA 1974123562 Merged r10255 from trunk to 1.4-stable
add missing fixture to test/unit/lib/redmine/safe_attributes_test.rb.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10262 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 05:09:12 +00:00
Toshi MARUYAMA bcef197b41 Merged r10256 from trunk to 1.4-stable
add missing fixtures to test/unit/lib/redmine/hook_test.rb.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10261 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 05:08:57 +00:00
Toshi MARUYAMA 231145160f Merged r10249 from trunk to 1.4-stable
set language en to test_label_for at test/unit/query_test.rb.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10260 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 05:08:42 +00:00
Toshi MARUYAMA 0e1ae572c7 Merged r10252 from trunk to 1.4-stable (#11752)
scm: git: use with_settings at test_diff_truncated of functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10259 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 05:08:22 +00:00
Toshi MARUYAMA b3a86771ce Merged r10251 from trunk to 1.4-stable (#11752)
scm: git: use diff_max_lines_displayed setting at test_diff_with_rev_and_path of functional test.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10258 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 05:08:06 +00:00
Toshi MARUYAMA 2516d4f408 Merged r9949 from trunk to 1.4-stable
Tests should not change settings.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10250 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-01 02:16:07 +00:00
Toshi MARUYAMA 03d6c4668e Merged r10245 from trunk to 1.4-stable (#11752)
scm: git: add functional test of diff with revision and path.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10248 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-31 23:55:56 +00:00
Toshi MARUYAMA a97d6baddd Merged r10230 from trunk (#11665)
add check default document category is not defined on database in tests.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10233 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-22 22:44:30 +00:00
Toshi MARUYAMA f3a8494cfb Merged r10219 from trunk to 1.4-stable (#11665)
add functional test to create non default document category.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10227 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 17:16:28 +00:00
Toshi MARUYAMA 14dcefaa97 set default category_id instead of the object (#11665)
Rails 2.3 still has issues with synchronizing the association_id
and association attributes of an object. That means, if you set the
association with an object first and then just set the id afterwards,
the object wins and the setting of the id gets lost.

This is not an issue in Rails >= 3.1 anymore.

Contributed by Holger Just.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10226 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 17:15:59 +00:00
Toshi MARUYAMA f4a7d6ca8c Merged r10221 from trunk to 1.4-stable (#11665)
force set default document category if it is not set on database.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10225 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 17:15:38 +00:00
Toshi MARUYAMA aedd5c5e35 Merged r10220 from trunk to 1.4-stable (#11665)
add unit test to get default document category defined on database.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10224 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 17:15:16 +00:00
Toshi MARUYAMA 554d6bcba2 Merged r10222 from trunk to 1.4-stable (#11665)
add position to DocumentCategory in enumerations fixture.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10223 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 17:14:53 +00:00
Toshi MARUYAMA 4fcec69a40 Merged r10216 from trunk
add missing fixtures to test/functional/documents_controller_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10218 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 04:53:10 +00:00
Toshi MARUYAMA 7e6cc2f583 Merged r10213 from trunk
add missing fixtures to test/unit/document_test.rb

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10215 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-21 02:25:58 +00:00
Toshi MARUYAMA 16383ed386 Merged r10169 from trunk to 1.4-stable (#11600)
fix plural form of the abbreviation for hours in Brazilian Portuguese.

Contributed by Mauricio Piacentini.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10173 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-08 01:39:09 +00:00
Toshi MARUYAMA 27127e1a3b Merged r10167 from trunk to 1.4-stable
Gemfile: mocha version up 0.12.3.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10172 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-08 01:38:54 +00:00
Toshi MARUYAMA a92ef237d3 Merged r10155 from trunk to 1.4-stable
Gemfile: pin mocha version 0.12.1.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10168 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-08-07 23:21:45 +00:00
Toshi MARUYAMA a82a16378f Merged r10137 from trunk to 1.4-stable (#10320, #10818)
Gemfile: prevent "rake db:migrate RAILS_ENV=test" causes exception on Ruby 1.9.3.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10139 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-31 08:47:21 +00:00
Toshi MARUYAMA 886daba641 Merged r10055 from trunk to 1.4-stable (#11448)
Russian translation for 1.4-stable and 2.0-stable updated by Александр Закревский.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10057 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-20 10:12:18 +00:00
Toshi MARUYAMA ab8dd5aa6e Backported r10005 from trunk to 1.4-stable (#11406, #11404)
German translation for configurable session lifetime and timeout updated by Hannes Meier.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10008 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-16 14:17:35 +00:00
Jean-Philippe Lang dbc02e66dc Backported r9982 and r9984 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@10000 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-15 16:00:58 +00:00
Jean-Philippe Lang 75e350f4e6 Merged r9924 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9960 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-08 12:38:57 +00:00
Jean-Philippe Lang 81553d396e Merged r9908 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9955 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-08 12:32:38 +00:00
Jean-Philippe Lang 77e03b508b Merged r9875 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9951 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-08 12:26:49 +00:00
Toshi MARUYAMA 1b0e717902 Merged r9911 from trunk to 1.4-stable (#11328)
Fix Japanese mistranslation for 'label_language_based'.

Contributed by Go MAEDA.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9918 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-07-05 13:10:27 +00:00
Toshi MARUYAMA 53b8de5e39 Backport r9890 from trunk to 1.4-stable
Simplified Chinese translation updated by Steven Wong (#11261).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9893 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-06-26 11:44:38 +00:00
Toshi MARUYAMA 34df573ec2 Merge r9870 from trunk
scm: git: fix unable to run unit lib test if git binary is not available on Windows.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9874 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-06-19 02:12:59 +00:00
54 changed files with 490 additions and 166 deletions
+1
View File
@@ -18,6 +18,7 @@
/public/plugin_assets /public/plugin_assets
/tmp/* /tmp/*
/tmp/cache/* /tmp/cache/*
/tmp/pdf/*
/tmp/sessions/* /tmp/sessions/*
/tmp/sockets/* /tmp/sockets/*
/tmp/test/* /tmp/test/*
+1
View File
@@ -20,6 +20,7 @@ public/dispatch.*
public/plugin_assets public/plugin_assets
tmp/* tmp/*
tmp/cache/* tmp/cache/*
tmp/pdf/*
tmp/sessions/* tmp/sessions/*
tmp/sockets/* tmp/sockets/*
tmp/test/* tmp/test/*
+3 -1
View File
@@ -71,8 +71,10 @@ end
group :test do group :test do
gem "shoulda", "~> 2.10.3" gem "shoulda", "~> 2.10.3"
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely.
gem "test-unit", :platforms => [:mri_19]
gem "edavis10-object_daddy", :require => "object_daddy" gem "edavis10-object_daddy", :require => "object_daddy"
gem "mocha" gem "mocha", "0.12.3"
end end
local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
+3 -1
View File
@@ -799,7 +799,7 @@ module ApplicationHelper
end end
end end
HEADING_RE = /(<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>)/i unless const_defined?(:HEADING_RE) HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE)
def parse_sections(text, project, obj, attr, only_path, options) def parse_sections(text, project, obj, attr, only_path, options)
return unless options[:edit_section_links] return unless options[:edit_section_links]
@@ -870,6 +870,8 @@ module ApplicationHelper
# Renders the TOC with given headings # Renders the TOC with given headings
def replace_toc(text, headings) def replace_toc(text, headings)
text.gsub!(TOC_RE) do text.gsub!(TOC_RE) do
# Keep only the 4 first levels
headings = headings.select{|level, anchor, item| level <= 4}
if headings.empty? if headings.empty?
'' ''
else else
+1
View File
@@ -24,6 +24,7 @@ class Attachment < ActiveRecord::Base
validates_presence_of :filename, :author validates_presence_of :filename, :author
validates_length_of :filename, :maximum => 255 validates_length_of :filename, :maximum => 255
validates_length_of :disk_filename, :maximum => 255 validates_length_of :disk_filename, :maximum => 255
validates_length_of :description, :maximum => 255, :allow_blank => true
validate :validate_max_file_size validate :validate_max_file_size
acts_as_event :title => :filename, acts_as_event :title => :filename,
+3 -1
View File
@@ -42,7 +42,9 @@ class Document < ActiveRecord::Base
def initialize(attributes=nil, *args) def initialize(attributes=nil, *args)
super super
if new_record? if new_record?
self.category ||= DocumentCategory.default # Rails3 use this instead
# self.category ||= DocumentCategory.default
self.category_id = DocumentCategory.default.id if self.category_id == 0
end end
end end
+8
View File
@@ -31,4 +31,12 @@ class DocumentCategory < Enumeration
def transfer_relations(to) def transfer_relations(to)
documents.update_all("category_id = #{to.id}") documents.update_all("category_id = #{to.id}")
end end
def self.default
d = super
if d.nil?
d = find(:first)
end
d
end
end end
+9 -6
View File
@@ -44,8 +44,8 @@ class MailHandler < ActionMailer::Base
cattr_accessor :ignored_emails_headers cattr_accessor :ignored_emails_headers
@@ignored_emails_headers = { @@ignored_emails_headers = {
'X-Auto-Response-Suppress' => 'OOF', 'X-Auto-Response-Suppress' => 'oof',
'Auto-Submitted' => 'auto-replied' 'Auto-Submitted' => /^auto-/
} }
# Processes incoming emails # Processes incoming emails
@@ -63,11 +63,14 @@ class MailHandler < ActionMailer::Base
# Ignore auto generated emails # Ignore auto generated emails
self.class.ignored_emails_headers.each do |key, ignored_value| self.class.ignored_emails_headers.each do |key, ignored_value|
value = email.header_string(key) value = email.header_string(key)
if value && value.to_s.downcase == ignored_value.downcase if value
if logger && logger.info value = value.to_s.downcase
logger.info "MailHandler: ignoring email with #{key}:#{value} header" if (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value
if logger && logger.info
logger.info "MailHandler: ignoring email with #{key}:#{value} header"
end
return false
end end
return false
end end
end end
@user = User.find_by_mail(sender_email) if sender_email.present? @user = User.find_by_mail(sender_email) if sender_email.present?
+2 -2
View File
@@ -174,9 +174,9 @@ class Query < ActiveRecord::Base
if values_for(field) if values_for(field)
case type_for(field) case type_for(field)
when :integer when :integer
add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d+$/) } add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^[+-]?\d+$/) }
when :float when :float
add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d+(\.\d*)?$/) } add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^[+-]?\d+(\.\d*)?$/) }
when :date, :date_past when :date, :date_past
case operator_for(field) case operator_for(field)
when "=", ">=", "<=", "><" when "=", ">=", "<=", "><"
+2 -2
View File
@@ -37,8 +37,8 @@ class Repository < ActiveRecord::Base
validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? }
validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true
validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph)
# donwcase letters, digits, dashes but not digits only # donwcase letters, digits, dashes, underscores but not digits only
validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-]*$/, :allow_blank => true validates_format_of :identifier, :with => /^(?!\d+$)[a-z0-9\-_]*$/, :allow_blank => true
# Checks if the SCM is enabled when creating a repository # Checks if the SCM is enabled when creating a repository
validate :repo_create_validation, :on => :create validate :repo_create_validation, :on => :create
+1 -1
View File
@@ -10,7 +10,7 @@
<span> <span>
<%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file', <%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file',
:onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%> :onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
<%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :placeholder => l(:label_optional_description) %> <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :maxlength => 255, :placeholder => l(:label_optional_description) %>
<%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %> <%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %>
</span> </span>
</span> </span>
+3 -2
View File
@@ -1,8 +1,9 @@
<h2><%= l(:label_revision) %> <%= @diff_format_revisions %> <%=h @path %></h2> <h2><%= l(:label_revision) %> <%= @diff_format_revisions %> <%=h @path %></h2>
<!-- Choose view type --> <!-- Choose view type -->
<% form_tag({:path => to_path_param(@path)}, :method => 'get') do %> <% form_tag({:action => 'diff', :id => @project,
<%= hidden_field_tag('rev', params[:rev]) if params[:rev] %> :repository_id => @repository.identifier_param,
:path => to_path_param(@path), :rev => @rev}, :method => 'get') do %>
<%= hidden_field_tag('rev_to', params[:rev_to]) if params[:rev_to] %> <%= hidden_field_tag('rev_to', params[:rev_to]) if params[:rev_to] %>
<p> <p>
<label><%= l(:label_view_diff) %></label> <label><%= l(:label_view_diff) %></label>
+2 -1
View File
@@ -1,7 +1,8 @@
<div class="contextual"> <div class="contextual">
<% form_tag( <% form_tag(
{:action => 'revision', :id => @project, {:action => 'revision', :id => @project,
:repository_id => @repository.identifier_param} :repository_id => @repository.identifier_param},
:method => :get
) do %> ) do %>
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 8 %> <%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 8 %>
<%= submit_tag 'OK' %> <%= submit_tag 'OK' %>
+1
View File
@@ -8,6 +8,7 @@ api.array :versions, api_meta(:total_count => @versions.size) do
api.description version.description api.description version.description
api.status version.status api.status version.status
api.due_date version.effective_date api.due_date version.effective_date
api.sharing version.sharing
render_api_custom_values version.custom_field_values, api render_api_custom_values version.custom_field_values, api
+1
View File
@@ -6,6 +6,7 @@ api.version do
api.description @version.description api.description @version.description
api.status @version.status api.status @version.status
api.due_date @version.effective_date api.due_date @version.effective_date
api.sharing @version.sharing
render_api_custom_values @version.custom_field_values, api render_api_custom_values @version.custom_field_values, api
+7 -7
View File
@@ -1019,8 +1019,8 @@ de:
description_date_from: Startdatum eintragen description_date_from: Startdatum eintragen
description_date_to: Enddatum eintragen description_date_to: Enddatum eintragen
label_parent_revision: Parent label_parent_revision: Vorgänger
label_child_revision: Child label_child_revision: Nachfolger
error_scm_annotate_big_text_file: Der Eintrag kann nicht umgesetzt werden, da er die maximale Textlänge überschreitet. error_scm_annotate_big_text_file: Der Eintrag kann nicht umgesetzt werden, da er die maximale Textlänge überschreitet.
setting_default_issue_start_date_to_creation_date: Aktuelles Datum als Beginn für neue Tickets verwenden setting_default_issue_start_date_to_creation_date: Aktuelles Datum als Beginn für neue Tickets verwenden
button_edit_section: Diesen Bereich bearbeiten button_edit_section: Diesen Bereich bearbeiten
@@ -1052,8 +1052,8 @@ de:
setting_unsubscribe: Erlaubt Benutzern das eigene Benutzerkonto zu löschen setting_unsubscribe: Erlaubt Benutzern das eigene Benutzerkonto zu löschen
button_delete_my_account: Mein Benutzerkonto löschen button_delete_my_account: Mein Benutzerkonto löschen
text_account_destroy_confirmation: Möchten Sie wirklich fortfahren?\nIhr Benutzerkonto wird für immer gelöscht und kann nicht wiederhergestellt werden. text_account_destroy_confirmation: Möchten Sie wirklich fortfahren?\nIhr Benutzerkonto wird für immer gelöscht und kann nicht wiederhergestellt werden.
error_session_expired: Your session has expired. Please login again. error_session_expired: Ihre Sitzung ist abgelaufen. Bitte melden Sie sich erneut an.
text_session_expiration_settings: "Warning: changing these settings may expire the current sessions including yours." text_session_expiration_settings: "Achtung: Änderungen können aktuelle Sitzungen beenden, Ihre eingeschlossen!"
setting_session_lifetime: Session maximum lifetime setting_session_lifetime: Längste Dauer einer Sitzung
setting_session_timeout: Session inactivity timeout setting_session_timeout: Zeitüberschreitung bei Inaktivität
label_session_expiration: Session expiration label_session_expiration: Ende einer Sitzung
+1 -1
View File
@@ -761,7 +761,7 @@ ja:
label_week: 週 label_week: 週
label_date_from: "日付指定: " label_date_from: "日付指定: "
label_date_to: から label_date_to: から
label_language_based: 既定の言語の設定に従う label_language_based: ユーザの言語の設定に従う
label_sort_by: "並び替え %{value}" label_sort_by: "並び替え %{value}"
label_send_test_email: テストメールを送信 label_send_test_email: テストメールを送信
label_feeds_access_key: RSSアクセスキー label_feeds_access_key: RSSアクセスキー
+4 -4
View File
@@ -18,10 +18,10 @@ pt-BR:
time: time:
formats: formats:
default: "%A, %d de %B de %Y, %H:%M hs" default: "%A, %d de %B de %Y, %H:%M h"
time: "%H:%M hs" time: "%H:%M h"
short: "%d/%m, %H:%M hs" short: "%d/%m, %H:%M h"
long: "%A, %d de %B de %Y, %H:%M hs" long: "%A, %d de %B de %Y, %H:%M h"
only_second: "%S" only_second: "%S"
datetime: datetime:
formats: formats:
+34 -34
View File
@@ -1092,11 +1092,11 @@ ru:
notice_issue_successful_create: Задача %{id} создана. notice_issue_successful_create: Задача %{id} создана.
label_between: между label_between: между
setting_issue_group_assignment: Разрешить назначение задач группам пользователей setting_issue_group_assignment: Разрешить назначение задач группам пользователей
label_diff: diff label_diff: Разница(diff)
text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo) text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
description_query_sort_criteria_direction: Sort direction description_query_sort_criteria_direction: Порядок сортировки
description_project_scope: Search scope description_project_scope: Search scope
description_filter: Filter description_filter: Фильтр
description_user_mail_notification: Mail notification settings description_user_mail_notification: Mail notification settings
description_date_from: Enter start date description_date_from: Enter start date
description_message_content: Message content description_message_content: Message content
@@ -1104,23 +1104,23 @@ ru:
description_date_range_interval: Choose range by selecting start and end date description_date_range_interval: Choose range by selecting start and end date
description_issue_category_reassign: Choose issue category description_issue_category_reassign: Choose issue category
description_search: Searchfield description_search: Searchfield
description_notes: Notes description_notes: Примечания
description_date_range_list: Choose range from list description_date_range_list: Выберите диапазон из списка
description_choose_project: Projects description_choose_project: Проекты
description_date_to: Enter end date description_date_to: Введите дату выполнения
description_query_sort_criteria_attribute: Sort attribute description_query_sort_criteria_attribute: Критерий сортировки
description_wiki_subpages_reassign: Choose new parent page description_wiki_subpages_reassign: Выбрать новую родительскую страницу
description_selected_columns: Selected Columns description_selected_columns: Выбранные столбцы
label_parent_revision: Parent label_parent_revision: Родительский
label_child_revision: Child label_child_revision: Дочерний
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size. error_scm_annotate_big_text_file: Комментарий невозможен из-за превышения максимального размера текстового файла.
setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues setting_default_issue_start_date_to_creation_date: Использовать текущую дату в качестве даты начала для новых задач
button_edit_section: Edit this section button_edit_section: Редактировать эту секцию
setting_repositories_encodings: Attachments and repositories encodings setting_repositories_encodings: Кодировка вложений и хранилищ
description_all_columns: All Columns description_all_columns: Все столбцы
button_export: Export button_export: Экспорт
label_export_options: "%{export_format} export options" label_export_options: "%{export_format} параметры экспорта"
error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{max_size}) error_attachment_too_big: Этот файл нельзя загрузить из-за превышения максимального размера файла (%{max_size})
notice_failed_to_save_time_entries: "Failed to save %{count} time entrie(s) on %{total} selected: %{ids}." notice_failed_to_save_time_entries: "Failed to save %{count} time entrie(s) on %{total} selected: %{ids}."
label_x_issues: label_x_issues:
zero: 0 Задач zero: 0 Задач
@@ -1128,21 +1128,21 @@ ru:
few: "%{count} Задач" few: "%{count} Задач"
many: "%{count} Задач" many: "%{count} Задач"
other: "%{count} Задач" other: "%{count} Задач"
label_repository_new: New repository label_repository_new: Новое хранилище
field_repository_is_default: Main repository field_repository_is_default: Хранилище по умолчанию
label_copy_attachments: Copy attachments label_copy_attachments: Копировать вложения
label_item_position: "%{position}/%{count}" label_item_position: "%{position}/%{count}"
label_completed_versions: Completed versions label_completed_versions: Завершенные версии
text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed. text_project_identifier_info: Допускаются только строчные латинские буквы (a-z), цифры, тире и подчеркивания.<br />После сохранения идентификатор изменить нельзя.
field_multiple: Multiple values field_multiple: Множественные значения
setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed setting_commit_cross_project_ref: Разрешить ссылаться и исправлять задачи во всех остальных проектах
text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes text_issue_conflict_resolution_add_notes: Добавить мои примечания и отказаться от моих изменений
text_issue_conflict_resolution_overwrite: Apply my changes anyway (previous notes will be kept but some changes may be overwritten) text_issue_conflict_resolution_overwrite: Применить мои изменения (все предыдущие замечания будут сохранены, но некоторые изменения могут быть перезаписаны)
notice_issue_update_conflict: The issue has been updated by an other user while you were editing it. notice_issue_update_conflict: Кто-то изменил задачу, пока вы ее редактировали.
text_issue_conflict_resolution_cancel: Discard all my changes and redisplay %{link} text_issue_conflict_resolution_cancel: Отменить мои изменения и показать задачу заново %{link}
permission_manage_related_issues: Manage related issues permission_manage_related_issues: Управление связанными задачами
field_ldap_filter: LDAP filter field_ldap_filter: Фильтр LDAP
label_search_for_watchers: Search for watchers to add label_search_for_watchers: Найти наблюдателей
notice_account_deleted: "Ваша учетная запись полностью удалена" notice_account_deleted: "Ваша учетная запись полностью удалена"
setting_unsubscribe: "Разрешить пользователям удалять свои учетные записи" setting_unsubscribe: "Разрешить пользователям удалять свои учетные записи"
button_delete_my_account: "Удалить мою учетную запись" button_delete_my_account: "Удалить мою учетную запись"
+2 -2
View File
@@ -52,8 +52,8 @@ zh:
one: "大约一小时" one: "大约一小时"
other: "大约 %{count} 小时" other: "大约 %{count} 小时"
x_hours: x_hours:
one: "1 hour" one: "1 小时"
other: "%{count} hours" other: "%{count} 小时"
x_days: x_days:
one: "一天" one: "一天"
other: "%{count} 天" other: "%{count} 天"
+21
View File
@@ -4,6 +4,27 @@ Redmine - project management software
Copyright (C) 2006-2012 Jean-Philippe Lang Copyright (C) 2006-2012 Jean-Philippe Lang
http://www.redmine.org/ http://www.redmine.org/
== 2012-11-17 v1.4.5
* Defect #10818: Running rake in test environment causes exception
* Defect #11192: Make repository identifier accept underscores
* Defect #11298: Issue API may not work on Ruby 1.9 in Redmine 1.4
* Defect #11307: Can't filter for negative numeric custom fields
* Defect #11365: Attachment description length is not validated
* Defect #11541: Version sharing is missing in the REST API
* Defect #11665: New document category is not saved properly
* Defect #11789: Edit section links broken with h5/h6 headings
* Defect #11966: 404 Error when switching mode in view revision differences in non-main repo
* Defect #12189: No tmp/pdf directory
* Defect #12196: "Page not found" on OK button in SCM "View all revisions" page
* Feature #11338: Exclude emails with auto-submitted => auto-generated
* Patch #9732: German translations
* Patch #11261: Simplified Chinese translation for configurable session lifetime and timeout
* Patch #11328: Fix Japanese mistranslation for 'label_language_based'
* Patch #11406: German translation for configurable session lifetime and timeout
* Patch #11448: Russian translation for 1.4-stable and 2.0-stable
* Patch #11600: Fix plural form of the abbreviation for hours in Brazilian Portuguese
== 2012-06-18 v1.4.4 == 2012-06-18 v1.4.4
* Defect #10688: PDF export from Wiki - Problems with tables * Defect #10688: PDF export from Wiki - Problems with tables
+1 -1
View File
@@ -4,7 +4,7 @@ module Redmine
module VERSION #:nodoc: module VERSION #:nodoc:
MAJOR = 1 MAJOR = 1
MINOR = 4 MINOR = 4
TINY = 4 TINY = 5
# Branch values: # Branch values:
# * official release: nil # * official release: nil
+1 -1
View File
@@ -29,7 +29,7 @@ module Redmine
end end
def method_missing(sym, *args, &block) def method_missing(sym, *args, &block)
if args.size == 1 && args.first.is_a?(Time) if args.size == 1 && args.first.is_a?(::Time)
__send__ sym, args.first.xmlschema, &block __send__ sym, args.first.xmlschema, &block
else else
super super
+4
View File
@@ -4,16 +4,19 @@ enumerations_001:
id: 1 id: 1
type: DocumentCategory type: DocumentCategory
active: true active: true
position: 1
enumerations_002: enumerations_002:
name: User documentation name: User documentation
id: 2 id: 2
type: DocumentCategory type: DocumentCategory
active: true active: true
position: 2
enumerations_003: enumerations_003:
name: Technical documentation name: Technical documentation
id: 3 id: 3
type: DocumentCategory type: DocumentCategory
active: true active: true
position: 3
enumerations_004: enumerations_004:
name: Low name: Low
id: 4 id: 4
@@ -92,3 +95,4 @@ enumerations_016:
id: 16 id: 16
type: DocumentCategory type: DocumentCategory
active: false active: false
position: 4
@@ -96,8 +96,13 @@ class AttachmentsControllerTest < ActionController::TestCase
end end
def test_save_diff_type def test_save_diff_type
@request.session[:user_id] = 1 # admin user1 = User.find(1)
user1.pref[:diff_type] = nil
user1.preference.save
user = User.find(1) user = User.find(1)
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
get :show, :id => 5 get :show, :id => 5
assert_response :success assert_response :success
assert_template 'diff' assert_template 'diff'
+23 -4
View File
@@ -18,7 +18,9 @@
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
class DocumentsControllerTest < ActionController::TestCase class DocumentsControllerTest < ActionController::TestCase
fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations fixtures :projects, :users, :roles, :members, :member_roles,
:enabled_modules, :documents, :enumerations,
:groups_users, :attachments
def setup def setup
User.current = nil User.current = nil
@@ -95,16 +97,16 @@ LOREM
def test_create_with_one_attachment def test_create_with_one_attachment
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.notified_events << 'document_added'
@request.session[:user_id] = 2 @request.session[:user_id] = 2
set_tmp_attachments_directory set_tmp_attachments_directory
post :create, :project_id => 'ecookbook', with_settings :notified_events => %w(document_added) do
post :create, :project_id => 'ecookbook',
:document => { :title => 'DocumentsControllerTest#test_post_new', :document => { :title => 'DocumentsControllerTest#test_post_new',
:description => 'This is a new document', :description => 'This is a new document',
:category_id => 2}, :category_id => 2},
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
end
assert_redirected_to '/projects/ecookbook/documents' assert_redirected_to '/projects/ecookbook/documents'
document = Document.find_by_title('DocumentsControllerTest#test_post_new') document = Document.find_by_title('DocumentsControllerTest#test_post_new')
@@ -124,6 +126,23 @@ LOREM
assert_template 'new' assert_template 'new'
end end
def test_create_non_default_category
@request.session[:user_id] = 2
category2 = Enumeration.find_by_name('User documentation')
category2.update_attributes(:is_default => true)
category1 = Enumeration.find_by_name('Uncategorized')
post :create,
:project_id => 'ecookbook',
:document => { :title => 'no default',
:description => 'This is a new document',
:category_id => category1.id }
assert_redirected_to '/projects/ecookbook/documents'
doc = Document.find_by_title('no default')
assert_not_nil doc
assert_equal category1.id, doc.category_id
assert_equal category1, doc.category
end
def test_edit def test_edit
@request.session[:user_id] = 2 @request.session[:user_id] = 2
get :edit, :id => 1 get :edit, :id => 1
+6 -6
View File
@@ -58,13 +58,14 @@ class FilesControllerTest < ActionController::TestCase
def test_create_file def test_create_file
set_tmp_attachments_directory set_tmp_attachments_directory
@request.session[:user_id] = 2 @request.session[:user_id] = 2
Setting.notified_events = ['file_added']
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
assert_difference 'Attachment.count' do with_settings :notified_events => %w(file_added) do
post :create, :project_id => 1, :version_id => '', assert_difference 'Attachment.count' do
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} post :create, :project_id => 1, :version_id => '',
assert_response :redirect :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
assert_response :redirect
end
end end
assert_redirected_to '/projects/ecookbook/files' assert_redirected_to '/projects/ecookbook/files'
a = Attachment.find(:first, :order => 'created_on DESC') a = Attachment.find(:first, :order => 'created_on DESC')
@@ -80,7 +81,6 @@ class FilesControllerTest < ActionController::TestCase
def test_create_version_file def test_create_version_file
set_tmp_attachments_directory set_tmp_attachments_directory
@request.session[:user_id] = 2 @request.session[:user_id] = 2
Setting.notified_events = ['file_added']
assert_difference 'Attachment.count' do assert_difference 'Attachment.count' do
post :create, :project_id => 1, :version_id => '2', post :create, :project_id => 1, :version_id => '2',
@@ -1305,6 +1305,7 @@ class IssuesControllerTest < ActionController::TestCase
:tag => 'input', :tag => 'input',
:attributes => {:type => 'file', :name => 'attachments[1][file]'} :attributes => {:type => 'file', :name => 'attachments[1][file]'}
} }
assert_select 'input[name=?][maxlength=255]', 'attachments[1][description]'
end end
def test_get_new_should_prefill_the_form_from_params def test_get_new_should_prefill_the_form_from_params
+3 -2
View File
@@ -91,11 +91,12 @@ class MessagesControllerTest < ActionController::TestCase
def test_post_new def test_post_new
@request.session[:user_id] = 2 @request.session[:user_id] = 2
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.notified_events = ['message_posted']
post :new, :board_id => 1, with_settings :notified_events => %w(message_posted) do
post :new, :board_id => 1,
:message => { :subject => 'Test created message', :message => { :subject => 'Test created message',
:content => 'Message body'} :content => 'Message body'}
end
message = Message.find_by_subject('Test created message') message = Message.find_by_subject('Test created message')
assert_not_nil message assert_not_nil message
assert_redirected_to "/boards/1/topics/#{message.to_param}" assert_redirected_to "/boards/1/topics/#{message.to_param}"
+4 -3
View File
@@ -82,12 +82,13 @@ class NewsControllerTest < ActionController::TestCase
def test_post_create def test_post_create
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.notified_events << 'news_added'
@request.session[:user_id] = 2 @request.session[:user_id] = 2
post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
with_settings :notified_events => %w(news_added) do
post :create, :project_id => 1, :news => { :title => 'NewsControllerTest',
:description => 'This is the description', :description => 'This is the description',
:summary => '' } :summary => '' }
end
assert_redirected_to '/projects/ecookbook/news' assert_redirected_to '/projects/ecookbook/news'
news = News.find_by_title('NewsControllerTest') news = News.find_by_title('NewsControllerTest')
@@ -53,8 +53,6 @@ class RepositoriesGitControllerTest < ActionController::TestCase
if @char_1.respond_to?(:force_encoding) if @char_1.respond_to?(:force_encoding)
@char_1.force_encoding('UTF-8') @char_1.force_encoding('UTF-8')
end end
Setting.default_language = 'en'
end end
def test_create_and_update def test_create_and_update
@@ -265,6 +263,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end end
def test_diff def test_diff
assert_equal true, @repository.is_default
assert_nil @repository.identifier
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
@@ -287,26 +287,55 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end end
end end
def test_diff_with_rev_and_path
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
with_settings :diff_max_lines_displayed => 1000 do
# Full diff of changeset 2f9c0091
['inline', 'sbs'].each do |dt|
get :diff,
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7',
:path => repository_path_hash(['sources', 'watchers_controller.rb'])[:param],
:type => dt
assert_response :success
assert_template 'diff'
# Line 22 removed
assert_tag :tag => 'th',
:content => '22',
:sibling => { :tag => 'td',
:attributes => { :class => /diff_out/ },
:content => /def remove/ }
assert_tag :tag => 'h2', :content => /2f9c0091/
end
end
end
def test_diff_truncated def test_diff_truncated
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets
@project.reload @project.reload
assert_equal NUM_REV, @repository.changesets.count assert_equal NUM_REV, @repository.changesets.count
Setting.diff_max_lines_displayed = 5
# Truncated diff of changeset 2f9c0091 with_settings :diff_max_lines_displayed => 5 do
with_cache do # Truncated diff of changeset 2f9c0091
get :diff, :id => PRJ_ID, :type => 'inline', with_cache do
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' with_settings :default_language => 'en' do
assert_response :success get :diff, :id => PRJ_ID, :type => 'inline',
assert @response.body.include?("... This diff was truncated") :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
assert_response :success
Setting.default_language = 'fr' assert @response.body.include?("... This diff was truncated")
get :diff, :id => PRJ_ID, :type => 'inline', end
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' with_settings :default_language => 'fr' do
assert_response :success get :diff, :id => PRJ_ID, :type => 'inline',
assert ! @response.body.include?("... This diff was truncated") :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
assert @response.body.include?("... Ce diff") assert_response :success
assert ! @response.body.include?("... This diff was truncated")
assert @response.body.include?("... Ce diff")
end
end
end end
end end
@@ -326,9 +355,55 @@ class RepositoriesGitControllerTest < ActionController::TestCase
diff = assigns(:diff) diff = assigns(:diff)
assert_not_nil diff assert_not_nil diff
assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/ assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
assert_tag :tag => "form",
:attributes => {
:action => "/projects/subproject1/repository/revisions/" +
"61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff"
}
assert_tag :tag => 'input',
:attributes => {
:id => "rev_to",
:name => "rev_to",
:type => "hidden",
:value => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
}
end end
end end
def test_diff_path_in_subrepo
repo = Repository::Git.create(
:project => @project,
:url => REPOSITORY_PATH,
:identifier => 'test-diff-path',
:path_encoding => 'ISO-8859-1'
);
assert repo
assert_equal false, repo.is_default
assert_equal 'test-diff-path', repo.identifier
get :diff,
:id => PRJ_ID,
:repository_id => 'test-diff-path',
:rev => '61b685fbe55ab05b',
:rev_to => '2f9c0091c754a91a',
:type => 'inline'
assert_response :success
assert_template 'diff'
diff = assigns(:diff)
assert_not_nil diff
assert_tag :tag => "form",
:attributes => {
:action => "/projects/subproject1/repository/test-diff-path/" +
"revisions/61b685fbe55ab05b/diff"
}
assert_tag :tag => 'input',
:attributes => {
:id => "rev_to",
:name => "rev_to",
:type => "hidden",
:value => '2f9c0091c754a91a'
}
end
def test_diff_latin_1 def test_diff_latin_1
if @ruby19_non_utf8_pass if @ruby19_non_utf8_pass
puts_ruby19_non_utf8_pass() puts_ruby19_non_utf8_pass()
@@ -360,8 +435,13 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end end
def test_save_diff_type def test_save_diff_type
@request.session[:user_id] = 1 # admin user1 = User.find(1)
user1.pref[:diff_type] = nil
user1.preference.save
user = User.find(1) user = User.find(1)
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
get :diff, get :diff,
:id => PRJ_ID, :id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
@@ -467,6 +547,21 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end end
end end
def test_revisions
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
get :revisions, :id => PRJ_ID
assert_response :success
assert_template 'revisions'
assert_tag :tag => 'form',
:attributes => {
:method => 'get',
:action => '/projects/subproject1/repository/revision'
}
end
def test_revision def test_revision
assert_equal 0, @repository.changesets.count assert_equal 0, @repository.changesets.count
@repository.fetch_changesets @repository.fetch_changesets
@@ -57,6 +57,7 @@ class SettingsControllerTest < ActionController::TestCase
assert !Setting.bcc_recipients? assert !Setting.bcc_recipients?
assert_equal %w(issue_added issue_updated news_added), Setting.notified_events assert_equal %w(issue_added issue_updated news_added), Setting.notified_events
assert_equal 'Test footer', Setting.emails_footer assert_equal 'Test footer', Setting.emails_footer
Setting.clear_cache
end end
def test_get_plugin_settings def test_get_plugin_settings
+4
View File
@@ -33,6 +33,10 @@ class SysControllerTest < ActionController::TestCase
Setting.enabled_scm = %w(Subversion Git) Setting.enabled_scm = %w(Subversion Git)
end end
def teardown
Setting.clear_cache
end
def test_projects_with_repository_enabled def test_projects_with_repository_enabled
get :projects get :projects
assert_response :success assert_response :success
+1
View File
@@ -25,6 +25,7 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
:member_roles, :member_roles,
:issues, :issues,
:issue_statuses, :issue_statuses,
:issue_relations,
:versions, :versions,
:trackers, :trackers,
:projects_trackers, :projects_trackers,
+5 -9
View File
@@ -103,15 +103,11 @@ class ApiTest::VersionsTest < ActionController::IntegrationTest
assert_response :success assert_response :success
assert_equal 'application/xml', @response.content_type assert_equal 'application/xml', @response.content_type
assert_tag 'version', assert_select 'version' do
:child => { assert_select 'id', :text => '2'
:tag => 'id', assert_select 'name', :text => '1.0'
:content => '2', assert_select 'sharing', :text => 'none'
:sibling => { end
:tag => 'name',
:content => '1.0'
}
}
end end
end end
+6
View File
@@ -75,6 +75,12 @@ class AttachmentTest < ActiveSupport::TestCase
end end
end end
def test_description_length_should_be_validated
a = Attachment.new(:description => 'a' * 300)
assert !a.save
assert_not_nil a.errors[:description]
end
def test_destroy def test_destroy
a = Attachment.new(:container => Issue.find(1), a = Attachment.new(:container => Issue.find(1),
:file => uploaded_test_file("testfile.txt", "text/plain"), :file => uploaded_test_file("testfile.txt", "text/plain"),
+2 -1
View File
@@ -179,7 +179,8 @@ class ChangesetTest < ActiveSupport::TestCase
end end
def test_commit_closing_a_subproject_issue def test_commit_closing_a_subproject_issue
with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes',
:default_language => 'en' do
issue = Issue.find(5) issue = Issue.find(5)
assert !issue.closed? assert !issue.closed?
assert_difference 'Journal.count' do assert_difference 'Journal.count' do
+4 -3
View File
@@ -33,11 +33,12 @@ class CommentTest < ActiveSupport::TestCase
end end
def test_create_should_send_notification def test_create_should_send_notification
Setting.notified_events << 'news_comment_added'
Watcher.create!(:watchable => @news, :user => @jsmith) Watcher.create!(:watchable => @news, :user => @jsmith)
assert_difference 'ActionMailer::Base.deliveries.size' do with_settings :notified_events => %w(news_comment_added) do
Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment") assert_difference 'ActionMailer::Base.deliveries.size' do
Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment")
end
end end
end end
+12
View File
@@ -32,4 +32,16 @@ class DocumentCategoryTest < ActiveSupport::TestCase
def test_option_name def test_option_name
assert_equal :enumeration_doc_categories, DocumentCategory.new.option_name assert_equal :enumeration_doc_categories, DocumentCategory.new.option_name
end end
def test_default
assert_nil DocumentCategory.find(:first, :conditions => { :is_default => true })
e = Enumeration.find_by_name('Technical documentation')
e.update_attributes(:is_default => true)
assert_equal 3, DocumentCategory.default.id
end
def test_force_default
assert_nil DocumentCategory.find(:first, :conditions => { :is_default => true })
assert_equal 1, DocumentCategory.default.id
end
end end
+8 -4
View File
@@ -18,7 +18,10 @@
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
class DocumentTest < ActiveSupport::TestCase class DocumentTest < ActiveSupport::TestCase
fixtures :projects, :enumerations, :documents, :attachments fixtures :projects, :enumerations, :documents, :attachments,
:enabled_modules,
:users, :members, :member_roles, :roles,
:groups_users
def test_create def test_create
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation')) doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
@@ -27,10 +30,11 @@ class DocumentTest < ActiveSupport::TestCase
def test_create_should_send_email_notification def test_create_should_send_email_notification
ActionMailer::Base.deliveries.clear 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 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
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
+36 -8
View File
@@ -107,25 +107,53 @@ class IssuesHelperTest < ActionView::TestCase
context "with a start_date attribute" do context "with a start_date attribute" do
should "format the current date" do should "format the current date" do
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date') @detail = JournalDetail.new(
assert_match "01/31/2010", show_detail(@detail, true) :property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'start_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
end end
should "format the old date" do should "format the old date" do
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date') @detail = JournalDetail.new(
assert_match "01/01/2010", show_detail(@detail, true) :property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'start_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
end end
end end
context "with a due_date attribute" do context "with a due_date attribute" do
should "format the current date" do should "format the current date" do
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date') @detail = JournalDetail.new(
assert_match "01/31/2010", show_detail(@detail, true) :property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'due_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
end end
should "format the old date" do should "format the old date" do
@detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date') @detail = JournalDetail.new(
assert_match "01/01/2010", show_detail(@detail, true) :property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'due_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
end end
end end
+11 -1
View File
@@ -18,7 +18,17 @@
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
class IssueRelationTest < ActiveSupport::TestCase class IssueRelationTest < ActiveSupport::TestCase
fixtures :issue_relations, :issues fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:enabled_modules,
:enumerations,
:trackers
def test_create def test_create
from = Issue.find(1) from = Issue.find(1)
+27 -18
View File
@@ -27,102 +27,111 @@ class JournalObserverTest < ActiveSupport::TestCase
# context: issue_updated notified_events # context: issue_updated notified_events
def test_create_should_send_email_notification_with_issue_updated def test_create_should_send_email_notification_with_issue_updated
Setting.notified_events = ['issue_updated']
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
journal = issue.init_journal(user, issue) journal = issue.init_journal(user, issue)
assert journal.save with_settings :notified_events => %w(issue_updated) do
assert journal.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
def test_create_should_not_send_email_notification_with_notify_set_to_false def test_create_should_not_send_email_notification_with_notify_set_to_false
Setting.notified_events = ['issue_updated']
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
journal = issue.init_journal(user, issue) journal = issue.init_journal(user, issue)
journal.notify = false journal.notify = false
assert journal.save with_settings :notified_events => %w(issue_updated) do
assert journal.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
def test_create_should_not_send_email_notification_without_issue_updated def test_create_should_not_send_email_notification_without_issue_updated
Setting.notified_events = []
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
journal = issue.init_journal(user, issue) journal = issue.init_journal(user, issue)
assert journal.save with_settings :notified_events => [] do
assert journal.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
# context: issue_note_added notified_events # context: issue_note_added notified_events
def test_create_should_send_email_notification_with_issue_note_added def test_create_should_send_email_notification_with_issue_note_added
Setting.notified_events = ['issue_note_added']
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
journal = issue.init_journal(user, issue) journal = issue.init_journal(user, issue)
journal.notes = 'This update has a note' journal.notes = 'This update has a note'
assert journal.save with_settings :notified_events => %w(issue_note_added) do
assert journal.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
def test_create_should_not_send_email_notification_without_issue_note_added def test_create_should_not_send_email_notification_without_issue_note_added
Setting.notified_events = []
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
journal = issue.init_journal(user, issue) journal = issue.init_journal(user, issue)
journal.notes = 'This update has a note' journal.notes = 'This update has a note'
assert journal.save with_settings :notified_events => [] do
assert journal.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
# context: issue_status_updated notified_events # context: issue_status_updated notified_events
def test_create_should_send_email_notification_with_issue_status_updated def test_create_should_send_email_notification_with_issue_status_updated
Setting.notified_events = ['issue_status_updated']
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
issue.init_journal(user, issue) issue.init_journal(user, issue)
issue.status = IssueStatus.last issue.status = IssueStatus.last
assert issue.save with_settings :notified_events => %w(issue_status_updated) do
assert issue.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
def test_create_should_not_send_email_notification_without_issue_status_updated def test_create_should_not_send_email_notification_without_issue_status_updated
Setting.notified_events = []
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
issue.init_journal(user, issue) issue.init_journal(user, issue)
issue.status = IssueStatus.last issue.status = IssueStatus.last
assert issue.save with_settings :notified_events => [] do
assert issue.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
# context: issue_priority_updated notified_events # context: issue_priority_updated notified_events
def test_create_should_send_email_notification_with_issue_priority_updated def test_create_should_send_email_notification_with_issue_priority_updated
Setting.notified_events = ['issue_priority_updated']
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
issue.init_journal(user, issue) issue.init_journal(user, issue)
issue.priority = IssuePriority.last issue.priority = IssuePriority.last
assert issue.save with_settings :notified_events => %w(issue_priority_updated) do
assert issue.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
def test_create_should_not_send_email_notification_without_issue_priority_updated def test_create_should_not_send_email_notification_without_issue_priority_updated
Setting.notified_events = []
issue = Issue.find(:first) issue = Issue.find(:first)
user = User.find(:first) user = User.find(:first)
issue.init_journal(user, issue) issue.init_journal(user, issue)
issue.priority = IssuePriority.last issue.priority = IssuePriority.last
assert issue.save with_settings :notified_events => [] do
assert issue.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
end end
+8 -2
View File
@@ -18,8 +18,14 @@
require File.expand_path('../../../../test_helper', __FILE__) require File.expand_path('../../../../test_helper', __FILE__)
class Redmine::Hook::ManagerTest < ActiveSupport::TestCase class Redmine::Hook::ManagerTest < ActiveSupport::TestCase
fixtures :projects, :users, :members, :member_roles, :roles,
fixtures :issues :groups_users,
:trackers, :projects_trackers,
:enabled_modules,
:versions,
:issue_statuses, :issue_categories, :issue_relations, :workflows,
:enumerations,
:issues
# Some hooks that are manually registered in these tests # Some hooks that are manually registered in these tests
class TestHook < Redmine::Hook::ViewListener; end class TestHook < Redmine::Hook::ViewListener; end
+18
View File
@@ -126,6 +126,24 @@ class Redmine::I18nTest < ActiveSupport::TestCase
end end
end end
def test_number_to_currency_for_each_language
valid_languages.each do |lang|
set_language_if_valid lang
assert_nothing_raised "#{lang} failure" do
number_to_currency(-1000.2)
end
end
end
def test_number_to_currency_default
set_language_if_valid 'bs'
assert_equal "KM -1000,20", number_to_currency(-1000.2)
set_language_if_valid 'de'
euro_sign = "\xe2\x82\xac"
euro_sign.force_encoding('UTF-8') if euro_sign.respond_to?(:force_encoding)
assert_equal "-1000,20 #{euro_sign}", number_to_currency(-1000.2)
end
def test_valid_languages def test_valid_languages
assert valid_languages.is_a?(Array) assert valid_languages.is_a?(Array)
assert valid_languages.first.is_a?(Symbol) assert valid_languages.first.is_a?(Symbol)
@@ -18,6 +18,7 @@
require File.expand_path('../../../../test_helper', __FILE__) require File.expand_path('../../../../test_helper', __FILE__)
class Redmine::SafeAttributesTest < ActiveSupport::TestCase class Redmine::SafeAttributesTest < ActiveSupport::TestCase
fixtures :users
class Base class Base
def attributes=(attrs) def attributes=(attrs)
@@ -10,16 +10,6 @@ begin
FELIX_HEX = "Felix Sch\xC3\xA4fer" FELIX_HEX = "Felix Sch\xC3\xA4fer"
CHAR_1_HEX = "\xc3\x9c" CHAR_1_HEX = "\xc3\x9c"
## Ruby uses ANSI api to fork a process on Windows.
## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem
## and these are incompatible with ASCII.
## Git for Windows (msysGit) changed internal API from ANSI to Unicode in 1.7.10
## http://code.google.com/p/msysgit/issues/detail?id=80
## So, Latin-1 path tests fail on Japanese Windows
WINDOWS_PASS = (Redmine::Platform.mswin? &&
Redmine::Scm::Adapters::GitAdapter.client_version_above?([1, 7, 10]))
WINDOWS_SKIP_STR = "TODO: This test fails in Git for Windows above 1.7.10"
## Git, Mercurial and CVS path encodings are binary. ## Git, Mercurial and CVS path encodings are binary.
## Subversion supports URL encoding for path. ## Subversion supports URL encoding for path.
## Redmine Mercurial adapter and extension use URL encoding. ## Redmine Mercurial adapter and extension use URL encoding.
@@ -29,6 +19,16 @@ begin
JRUBY_SKIP_STR = "TODO: This test fails in JRuby" JRUBY_SKIP_STR = "TODO: This test fails in JRuby"
if File.directory?(REPOSITORY_PATH) if File.directory?(REPOSITORY_PATH)
## Ruby uses ANSI api to fork a process on Windows.
## Japanese Shift_JIS and Traditional Chinese Big5 have 0x5c(backslash) problem
## and these are incompatible with ASCII.
## Git for Windows (msysGit) changed internal API from ANSI to Unicode in 1.7.10
## http://code.google.com/p/msysgit/issues/detail?id=80
## So, Latin-1 path tests fail on Japanese Windows
WINDOWS_PASS = (Redmine::Platform.mswin? &&
Redmine::Scm::Adapters::GitAdapter.client_version_above?([1, 7, 10]))
WINDOWS_SKIP_STR = "TODO: This test fails in Git for Windows above 1.7.10"
def setup def setup
adapter_class = Redmine::Scm::Adapters::GitAdapter adapter_class = Redmine::Scm::Adapters::GitAdapter
assert adapter_class assert adapter_class
+6 -1
View File
@@ -35,6 +35,10 @@ class MailHandlerTest < ActiveSupport::TestCase
Setting.notified_events = Redmine::Notifiable.all.collect(&:name) Setting.notified_events = Redmine::Notifiable.all.collect(&:name)
end end
def teardown
Setting.clear_cache
end
def test_add_issue def test_add_issue
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
# This email contains: 'Project: onlinestore' # This email contains: 'Project: onlinestore'
@@ -363,7 +367,8 @@ class MailHandlerTest < ActiveSupport::TestCase
[ [
"X-Auto-Response-Suppress: OOF", "X-Auto-Response-Suppress: OOF",
"Auto-Submitted: auto-replied", "Auto-Submitted: auto-replied",
"Auto-Submitted: Auto-Replied" "Auto-Submitted: Auto-Replied",
"Auto-Submitted: auto-generated"
].each do |header| ].each do |header|
raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml')) raw = IO.read(File.join(FIXTURES_PATH, 'ticket_on_given_project.eml'))
raw = header + "\n" + raw raw = header + "\n" + raw
+3 -2
View File
@@ -29,10 +29,11 @@ class NewsTest < ActiveSupport::TestCase
def test_create_should_send_email_notification def test_create_should_send_email_notification
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
Setting.notified_events << 'news_added'
news = Project.find(1).news.new(valid_news) news = Project.find(1).news.new(valid_news)
assert news.save with_settings :notified_events => %w(news_added) do
assert news.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
+31
View File
@@ -18,6 +18,8 @@
require File.expand_path('../../test_helper', __FILE__) require File.expand_path('../../test_helper', __FILE__)
class QueryTest < ActiveSupport::TestCase class QueryTest < ActiveSupport::TestCase
include Redmine::I18n
fixtures :projects, :enabled_modules, :users, :members, fixtures :projects, :enabled_modules, :users, :members,
:member_roles, :roles, :trackers, :issue_statuses, :member_roles, :roles, :trackers, :issue_statuses,
:issue_categories, :enumerations, :issues, :issue_categories, :enumerations, :issues,
@@ -178,6 +180,20 @@ class QueryTest < ActiveSupport::TestCase
assert_equal 2, issues.first.id assert_equal 2, issues.first.id
end end
def test_operator_is_on_integer_custom_field_should_accept_negative_value
f = IssueCustomField.create!(:name => 'filter', :field_format => 'int', :is_for_all => true, :is_filter => true)
CustomValue.create!(:custom_field => f, :customized => Issue.find(1), :value => '7')
CustomValue.create!(:custom_field => f, :customized => Issue.find(2), :value => '-12')
CustomValue.create!(:custom_field => f, :customized => Issue.find(3), :value => '')
query = Query.new(:name => '_')
query.add_filter("cf_#{f.id}", '=', ['-12'])
assert query.valid?
issues = find_issues_with_query(query)
assert_equal 1, issues.size
assert_equal 2, issues.first.id
end
def test_operator_is_on_float_custom_field def test_operator_is_on_float_custom_field
f = IssueCustomField.create!(:name => 'filter', :field_format => 'float', :is_filter => true, :is_for_all => true) f = IssueCustomField.create!(:name => 'filter', :field_format => 'float', :is_filter => true, :is_for_all => true)
CustomValue.create!(:custom_field => f, :customized => Issue.find(1), :value => '7.3') CustomValue.create!(:custom_field => f, :customized => Issue.find(1), :value => '7.3')
@@ -191,6 +207,20 @@ class QueryTest < ActiveSupport::TestCase
assert_equal 2, issues.first.id assert_equal 2, issues.first.id
end end
def test_operator_is_on_float_custom_field_should_accept_negative_value
f = IssueCustomField.create!(:name => 'filter', :field_format => 'float', :is_filter => true, :is_for_all => true)
CustomValue.create!(:custom_field => f, :customized => Issue.find(1), :value => '7.3')
CustomValue.create!(:custom_field => f, :customized => Issue.find(2), :value => '-12.7')
CustomValue.create!(:custom_field => f, :customized => Issue.find(3), :value => '')
query = Query.new(:name => '_')
query.add_filter("cf_#{f.id}", '=', ['-12.7'])
assert query.valid?
issues = find_issues_with_query(query)
assert_equal 1, issues.size
assert_equal 2, issues.first.id
end
def test_operator_is_on_multi_list_custom_field def test_operator_is_on_multi_list_custom_field
f = IssueCustomField.create!(:name => 'filter', :field_format => 'list', :is_filter => true, :is_for_all => true, f = IssueCustomField.create!(:name => 'filter', :field_format => 'list', :is_filter => true, :is_for_all => true,
:possible_values => ['value1', 'value2', 'value3'], :multiple => true) :possible_values => ['value1', 'value2', 'value3'], :multiple => true)
@@ -729,6 +759,7 @@ class QueryTest < ActiveSupport::TestCase
end end
def test_label_for def test_label_for
set_language_if_valid 'en'
q = Query.new q = Query.new
assert_equal 'Assignee', q.label_for('assigned_to_id') assert_equal 'Assignee', q.label_for('assigned_to_id')
end end
+12 -2
View File
@@ -97,6 +97,15 @@ class RepositoryTest < ActiveSupport::TestCase
assert_equal [repository1, repository2], Project.find(3).repositories.sort assert_equal [repository1, repository2], Project.find(3).repositories.sort
end end
def test_identifier_should_accept_letters_digits_dashes_and_underscores
r = Repository::Subversion.new(
:project_id => 3,
:identifier => 'svn-123_45',
:url => 'file:///svn'
)
assert r.save
end
def test_destroy def test_destroy
changesets = Changeset.count(:all, :conditions => "repository_id = 10") changesets = Changeset.count(:all, :conditions => "repository_id = 10")
changes = Change.count(:all, :conditions => "repository_id = 10", changes = Change.count(:all, :conditions => "repository_id = 10",
@@ -139,7 +148,6 @@ class RepositoryTest < ActiveSupport::TestCase
def test_scan_changesets_for_issue_ids def test_scan_changesets_for_issue_ids
Setting.default_language = 'en' Setting.default_language = 'en'
Setting.notified_events = ['issue_added','issue_updated']
# choosing a status to apply to fix issues # choosing a status to apply to fix issues
Setting.commit_fix_status_id = IssueStatus.find( Setting.commit_fix_status_id = IssueStatus.find(
@@ -156,7 +164,9 @@ class RepositoryTest < ActiveSupport::TestCase
assert !fixed_issue.status.is_closed? assert !fixed_issue.status.is_closed?
old_status = fixed_issue.status old_status = fixed_issue.status
Repository.scan_changesets_for_issue_ids with_settings :notified_events => %w(issue_added issue_updated) do
Repository.scan_changesets_for_issue_ids
end
assert_equal [101, 102], Issue.find(3).changeset_ids assert_equal [101, 102], Issue.find(3).changeset_ids
# fixed issues # fixed issues
+4
View File
@@ -19,6 +19,10 @@ require File.expand_path('../../test_helper', __FILE__)
class SettingTest < ActiveSupport::TestCase class SettingTest < ActiveSupport::TestCase
def teardown
Setting.clear_cache
end
def test_read_default def test_read_default
assert_equal "Redmine", Setting.app_title assert_equal "Redmine", Setting.app_title
assert Setting.self_registration? assert Setting.self_registration?
+8 -4
View File
@@ -44,11 +44,13 @@ class WikiContentTest < ActiveSupport::TestCase
end end
def test_create_should_send_email_notification def test_create_should_send_email_notification
Setting.notified_events = ['wiki_content_added']
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
page = WikiPage.new(:wiki => @wiki, :title => "A new page") page = WikiPage.new(:wiki => @wiki, :title => "A new page")
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment") page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
assert page.save
with_settings :notified_events => %w(wiki_content_added) do
assert page.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
@@ -64,11 +66,13 @@ class WikiContentTest < ActiveSupport::TestCase
end end
def test_update_should_send_email_notification def test_update_should_send_email_notification
Setting.notified_events = ['wiki_content_updated']
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
content = @page.content content = @page.content
content.text = "My new content" content.text = "My new content"
assert content.save
with_settings :notified_events => %w(wiki_content_updated) do
assert content.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
View File