Compare commits

..
1 Commits
Author SHA1 Message Date
Jean-Philippe Lang 87e8b02828 tagged version 2.0.3
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/tags/2.0.3@9868 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-06-18 20:22:13 +00:00
55 changed files with 169 additions and 474 deletions
+2 -4
View File
@@ -5,7 +5,7 @@ gem 'prototype-rails', '3.2.1'
gem "i18n", "~> 0.6.0" gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6" gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby] gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0" gem "builder"
# Optional gem for LDAP authentication # Optional gem for LDAP authentication
group :ldap do group :ldap do
@@ -74,9 +74,7 @@ end
group :test do group :test do
gem "shoulda", "~> 2.11" gem "shoulda", "~> 2.11"
# Shoulda does not work nice on Ruby 1.9.3 and seems to need test-unit explicitely. gem "mocha"
gem "test-unit", :platforms => [:mri_19]
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")
+2 -4
View File
@@ -253,7 +253,7 @@ module ApplicationHelper
def project_tree_options_for_select(projects, options = {}) def project_tree_options_for_select(projects, options = {})
s = '' s = ''
project_tree(projects) do |project, level| project_tree(projects) do |project, level|
name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '').html_safe name_prefix = (level > 0 ? (' ' * 2 * level + '» ').html_safe : '')
tag_options = {:value => project.id} tag_options = {:value => project.id}
if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project))
tag_options[:selected] = 'selected' tag_options[:selected] = 'selected'
@@ -812,7 +812,7 @@ module ApplicationHelper
end end
end end
HEADING_RE = /(<h(\d)( [^>]+)?>(.+?)<\/h(\d)>)/i unless const_defined?(:HEADING_RE) HEADING_RE = /(<h(1|2|3|4)( [^>]+)?>(.+?)<\/h(1|2|3|4)>)/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]
@@ -883,8 +883,6 @@ 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,7 +24,6 @@ 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
validate :validate_max_file_size validate :validate_max_file_size
acts_as_event :title => :filename, acts_as_event :title => :filename,
+6 -9
View File
@@ -50,8 +50,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-/ 'Auto-Submitted' => 'auto-replied'
} }
# Processes incoming emails # Processes incoming emails
@@ -69,14 +69,11 @@ 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[key] value = email.header[key]
if value if value && value.to_s.downcase == ignored_value.downcase
value = value.to_s.downcase if logger && logger.info
if (ignored_value.is_a?(Regexp) && value.match(ignored_value)) || value == ignored_value logger.info "MailHandler: ignoring email with #{key}:#{value} header"
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?
+1 -3
View File
@@ -361,9 +361,7 @@ class Mailer < ActionMailer::Base
def self.with_synched_deliveries(&block) def self.with_synched_deliveries(&block)
saved_method = ActionMailer::Base.delivery_method saved_method = ActionMailer::Base.delivery_method
if m = saved_method.to_s.match(%r{^async_(.+)$}) if m = saved_method.to_s.match(%r{^async_(.+)$})
synched_method = m[1] ActionMailer::Base.delivery_method = m[1].to_sym
ActionMailer::Base.delivery_method = synched_method.to_sym
ActionMailer::Base.send "#{synched_method}_settings=", ActionMailer::Base.send("async_#{synched_method}_settings")
end end
yield yield
ensure ensure
+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, underscores but not digits only # donwcase letters, digits, dashes 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', :maxlength => 255, :placeholder => l(:label_optional_description) %> <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :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>
+1 -1
View File
@@ -21,6 +21,6 @@
<% if @notes.present? %> <% if @notes.present? %>
<label><%= radio_button_tag 'conflict_resolution', 'add_notes' %> <%= l(:text_issue_conflict_resolution_add_notes) %></label><br /> <label><%= radio_button_tag 'conflict_resolution', 'add_notes' %> <%= l(:text_issue_conflict_resolution_add_notes) %></label><br />
<% end %> <% end %>
<label><%= radio_button_tag 'conflict_resolution', 'cancel' %> <%= l(:text_issue_conflict_resolution_cancel, :link => link_to_issue(@issue, :subject => false)).html_safe %></label> <label><%= radio_button_tag 'conflict_resolution', 'cancel' %> <%= l(:text_issue_conflict_resolution_cancel, :link => link_to_issue(@issue, :subject => false)) %></label>
</p> </p>
<p><%= submit_tag l(:button_submit) %></p> <p><%= submit_tag l(:button_submit) %></p>
+1 -1
View File
@@ -1,3 +1,3 @@
<p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url), <p><%= l(:mail_body_wiki_content_added, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %><br /> :author => h(@wiki_content.author)) %><br />
<em><%=h @wiki_content.comments %></em></p> <em><%=h @wiki_content.comments %></em></p>
@@ -1,5 +1,5 @@
<p><%= l(:mail_body_wiki_content_updated, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url), <p><%= l(:mail_body_wiki_content_updated, :id => link_to(h(@wiki_content.page.pretty_title), @wiki_content_url),
:author => h(@wiki_content.author)).html_safe %><br /> :author => h(@wiki_content.author)) %><br />
<em><%=h @wiki_content.comments %></em></p> <em><%=h @wiki_content.comments %></em></p>
<p><%= l(:label_view_diff) %>:<br /> <p><%= l(:label_view_diff) %>:<br />
+1 -2
View File
@@ -4,8 +4,7 @@
<%=l(:text_project_destroy_confirmation)%> <%=l(:text_project_destroy_confirmation)%>
<% if @project_to_destroy.descendants.any? %> <% if @project_to_destroy.descendants.any? %>
<br /><%= l(:text_subprojects_destroy_warning, <br /><%= l(:text_subprojects_destroy_warning, content_tag('strong', h(@project_to_destroy.descendants.collect{|p| p.to_s}.join(', ')))) %>
content_tag('strong', h(@project_to_destroy.descendants.collect{|p| p.to_s}.join(', ')))).html_safe %>
<% end %> <% end %>
</p> </p>
<p> <p>
+1 -1
View File
@@ -758,7 +758,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 h" default: "%A, %d de %B de %Y, %H:%M hs"
time: "%H:%M h" time: "%H:%M hs"
short: "%d/%m, %H:%M h" short: "%d/%m, %H:%M hs"
long: "%A, %d de %B de %Y, %H:%M h" long: "%A, %d de %B de %Y, %H:%M hs"
only_second: "%S" only_second: "%S"
datetime: datetime:
formats: formats:
+34 -34
View File
@@ -1089,11 +1089,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: Порядок сортировки description_query_sort_criteria_direction: Sort direction
description_project_scope: Search scope description_project_scope: Search scope
description_filter: Фильтр description_filter: 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
@@ -1101,23 +1101,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: Примечания description_notes: Notes
description_date_range_list: Выберите диапазон из списка description_date_range_list: Choose range from list
description_choose_project: Проекты description_choose_project: Projects
description_date_to: Введите дату выполнения description_date_to: Enter end date
description_query_sort_criteria_attribute: Критерий сортировки description_query_sort_criteria_attribute: Sort attribute
description_wiki_subpages_reassign: Выбрать новую родительскую страницу description_wiki_subpages_reassign: Choose new parent page
description_selected_columns: Выбранные столбцы description_selected_columns: Selected Columns
label_parent_revision: Родительский label_parent_revision: Parent
label_child_revision: Дочерний label_child_revision: Child
error_scm_annotate_big_text_file: Комментарий невозможен из-за превышения максимального размера текстового файла. error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Использовать текущую дату в качестве даты начала для новых задач setting_default_issue_start_date_to_creation_date: Use current date as start date for new issues
button_edit_section: Редактировать эту секцию button_edit_section: Edit this section
setting_repositories_encodings: Кодировка вложений и хранилищ setting_repositories_encodings: Attachments and repositories encodings
description_all_columns: Все столбцы description_all_columns: All Columns
button_export: Экспорт button_export: Export
label_export_options: "%{export_format} параметры экспорта" label_export_options: "%{export_format} export options"
error_attachment_too_big: Этот файл нельзя загрузить из-за превышения максимального размера файла (%{max_size}) error_attachment_too_big: This file cannot be uploaded because it exceeds the maximum allowed file size (%{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 Задач
@@ -1125,21 +1125,21 @@ ru:
few: "%{count} Задач" few: "%{count} Задач"
many: "%{count} Задач" many: "%{count} Задач"
other: "%{count} Задач" other: "%{count} Задач"
label_repository_new: Новое хранилище label_repository_new: New repository
field_repository_is_default: Хранилище по умолчанию field_repository_is_default: Main repository
label_copy_attachments: Копировать вложения label_copy_attachments: Copy attachments
label_item_position: "%{position}/%{count}" label_item_position: "%{position}/%{count}"
label_completed_versions: Завершенные версии label_completed_versions: Completed versions
text_project_identifier_info: Допускаются только строчные латинские буквы (a-z), цифры, тире и подчеркивания.<br />После сохранения идентификатор изменить нельзя. text_project_identifier_info: Only lower case letters (a-z), numbers, dashes and underscores are allowed.<br />Once saved, the identifier cannot be changed.
field_multiple: Множественные значения field_multiple: Multiple values
setting_commit_cross_project_ref: Разрешить ссылаться и исправлять задачи во всех остальных проектах setting_commit_cross_project_ref: Allow issues of all the other projects to be referenced and fixed
text_issue_conflict_resolution_add_notes: Добавить мои примечания и отказаться от моих изменений text_issue_conflict_resolution_add_notes: Add my notes and discard my other changes
text_issue_conflict_resolution_overwrite: Применить мои изменения (все предыдущие замечания будут сохранены, но некоторые изменения могут быть перезаписаны) text_issue_conflict_resolution_overwrite: Apply my changes anyway (previous notes will be kept but some changes may be overwritten)
notice_issue_update_conflict: Кто-то изменил задачу, пока вы ее редактировали. notice_issue_update_conflict: The issue has been updated by an other user while you were editing it.
text_issue_conflict_resolution_cancel: Отменить мои изменения и показать задачу заново %{link} text_issue_conflict_resolution_cancel: Discard all my changes and redisplay %{link}
permission_manage_related_issues: Управление связанными задачами permission_manage_related_issues: Manage related issues
field_ldap_filter: Фильтр LDAP field_ldap_filter: LDAP filter
label_search_for_watchers: Найти наблюдателей label_search_for_watchers: Search for watchers to add
notice_account_deleted: "Ваша учетная запись полностью удалена" notice_account_deleted: "Ваша учетная запись полностью удалена"
setting_unsubscribe: "Разрешить пользователям удалять свои учетные записи" setting_unsubscribe: "Разрешить пользователям удалять свои учетные записи"
button_delete_my_account: "Удалить мою учетную запись" button_delete_my_account: "Удалить мою учетную запись"
-2
View File
@@ -224,7 +224,6 @@ RedmineApp::Application.routes.draw do
get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions'
get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))',
:controller => 'repositories', :controller => 'repositories',
:format => false,
:constraints => { :constraints => {
:action => /(browse|show|entry|raw|annotate|diff)/, :action => /(browse|show|entry|raw|annotate|diff)/,
:rev => /[a-z0-9\.\-_]+/ :rev => /[a-z0-9\.\-_]+/
@@ -243,7 +242,6 @@ RedmineApp::Application.routes.draw do
delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue'
get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))',
:controller => 'repositories', :controller => 'repositories',
:format => false,
:constraints => { :constraints => {
:action => /(browse|show|entry|raw|annotate|diff)/, :action => /(browse|show|entry|raw|annotate|diff)/,
:rev => /[a-z0-9\.\-_]+/ :rev => /[a-z0-9\.\-_]+/
-22
View File
@@ -4,28 +4,6 @@ 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-09-16 v2.0.4
* Defect #10818: Running rake in test environment causes exception
* Defect #11209: Wiki diff may generate broken HTML
* Defect #11217: Project names in drop-down are escaped twice
* Defect #11262: Link is escaped in wiki added/updated notification email
* Defect #11307: Can't filter for negative numeric custom fields
* Defect #11325: Unified diff link broken on specific file/revision diff view
* Defect #11341: Escaped link in conflict resolution form
* Defect #11365: Attachment description length is not validated
* Defect #11511: Confirmation page has broken HTML when a project folding sub project is deleted
* Defect #11533: rake redmine:plugins:test doesn't run tests in subdirectories
* Defect #11541: Version sharing is missing in the REST API
* Defect #11550: Issue reminder doesn't work when using asynchronous delivery
* Defect #11776: Can't override mailer views inside redmine plugin.
* Defect #11789: Edit section links broken with h5/h6 headings
* Feature #11338: Exclude emails with auto-submitted => auto-generated
* Patch #11299: redmine:plugins:migrate should update db/schema.rb
* Patch #11328: Fix Japanese mistranslation for 'label_language_based'
* 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 v2.0.3 == 2012-06-18 v2.0.3
* Defect #10688: PDF export from Wiki - Problems with tables * Defect #10688: PDF export from Wiki - Problems with tables
+2 -5
View File
@@ -13,7 +13,7 @@ http://www.redmine.org/
* A database: * A database:
* MySQL (tested with MySQL 5.1) * MySQL (tested with MySQL 5.1)
* PostgreSQL (tested with PostgreSQL 9.1) * PostgreSQL (tested with PostgreSQL 8.4)
* SQLite3 (tested with SQLite 3.6) * SQLite3 (tested with SQLite 3.6)
Optional: Optional:
@@ -38,10 +38,7 @@ Optional:
3. Create an empty utf8 encoded database: "redmine" for example 3. Create an empty utf8 encoded database: "redmine" for example
4. Configure the database parameters in config/database.yml 4. Configure the database parameters in config/database.yml
for the "production" environment (default database is MySQL and ruby1.8) for the "production" environment (default database is MySQL)
If you're running Redmine with MySQL and ruby1.9, replace the adapter name
with `mysql2`
5. Generate a session store secret 5. Generate a session store secret
+1 -17
View File
@@ -2,23 +2,7 @@ Description:
The plugin generator creates stubs for a new Redmine plugin. The plugin generator creates stubs for a new Redmine plugin.
Example: Example:
./script/rails generate redmine_plugin meetings ./script/generate redmine_plugin meetings
create plugins/meetings/app
create plugins/meetings/app/controllers
create plugins/meetings/app/helpers
create plugins/meetings/app/models
create plugins/meetings/app/views
create plugins/meetings/db/migrate
create plugins/meetings/lib/tasks
create plugins/meetings/assets/images
create plugins/meetings/assets/javascripts
create plugins/meetings/assets/stylesheets
create plugins/meetings/config/locales
create plugins/meetings/test
create plugins/meetings/test/fixtures
create plugins/meetings/test/unit
create plugins/meetings/test/functional
create plugins/meetings/test/integration
create plugins/meetings/README.rdoc create plugins/meetings/README.rdoc
create plugins/meetings/init.rb create plugins/meetings/init.rb
create plugins/meetings/config/routes.rb create plugins/meetings/config/routes.rb
@@ -2,4 +2,4 @@ Description:
Generates a plugin controller. Generates a plugin controller.
Example: Example:
./script/rails generate redmine_plugin_controller meetings pools index show vote ./script/generate redmine_plugin_controller meetings pools index show vote
+1 -1
View File
@@ -2,4 +2,4 @@ Description:
Generates a plugin model. Generates a plugin model.
Examples: Examples:
./script/rails generate redmine_plugin_model meetings pool ./script/generate redmine_plugin_model meetings pool
+4 -5
View File
@@ -50,17 +50,16 @@ module Redmine
words_add += 1 words_add += 1
else else
del_at = pos unless del_at del_at = pos unless del_at
deleted << ' ' unless deleted.empty? deleted << ' ' + h(change[2])
deleted << h(change[2])
words_del += 1 words_del += 1
end end
end end
if add_at if add_at
words[add_at] = '<span class="diff_in">'.html_safe + words[add_at] words[add_at] = '<span class="diff_in">' + words[add_at]
words[add_to] = words[add_to] + '</span>'.html_safe words[add_to] = words[add_to] + '</span>'
end end
if del_at if del_at
words.insert del_at - del_off + dels + words_add, '<span class="diff_out">'.html_safe + deleted + '</span>'.html_safe words.insert del_at - del_off + dels + words_add, '<span class="diff_out">' + deleted + '</span>'
dels += 1 dels += 1
del_off += words_del del_off += words_del
words_del = 0 words_del = 0
-1
View File
@@ -82,7 +82,6 @@ module Redmine #:nodoc:
view_path = File.join(p.directory, 'app', 'views') view_path = File.join(p.directory, 'app', 'views')
if File.directory?(view_path) if File.directory?(view_path)
ActionController::Base.prepend_view_path(view_path) ActionController::Base.prepend_view_path(view_path)
ActionMailer::Base.prepend_view_path(view_path)
end end
# Adds the app/{controllers,helpers,models} directories of the plugin to the autoload path # Adds the app/{controllers,helpers,models} directories of the plugin to the autoload path
+1 -1
View File
@@ -4,7 +4,7 @@ module Redmine
module VERSION #:nodoc: module VERSION #:nodoc:
MAJOR = 2 MAJOR = 2
MINOR = 0 MINOR = 0
TINY = 4 TINY = 3
# Branch values: # Branch values:
# * official release: nil # * official release: nil
-32
View File
@@ -70,8 +70,6 @@ namespace :redmine do
rescue Redmine::PluginNotFound rescue Redmine::PluginNotFound
abort "Plugin #{name} was not found." abort "Plugin #{name} was not found."
end end
Rake::Task["db:schema:dump"].invoke
end end
desc 'Copies plugins assets into the public directory.' desc 'Copies plugins assets into the public directory.'
@@ -84,36 +82,6 @@ namespace :redmine do
abort "Plugin #{name} was not found." abort "Plugin #{name} was not found."
end end
end end
desc 'Runs the plugins tests.'
task :test do
Rake::Task["redmine:plugins:test:units"].invoke
Rake::Task["redmine:plugins:test:functionals"].invoke
Rake::Task["redmine:plugins:test:integration"].invoke
end
namespace :test do
desc 'Runs the plugins unit tests.'
Rake::TestTask.new :units => "db:test:prepare" do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/unit/**/*_test.rb"]
end
desc 'Runs the plugins functional tests.'
Rake::TestTask.new :functionals => "db:test:prepare" do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/functional/**/*_test.rb"]
end
desc 'Runs the plugins integration tests.'
Rake::TestTask.new :integration => "db:test:prepare" do |t|
t.libs << "test"
t.verbose = true
t.test_files = FileList["plugins/#{ENV['NAME'] || '*'}/test/integration/**/*_test.rb"]
end
end
end end
end end
@@ -55,16 +55,13 @@ class ActivitiesControllerTest < ActionController::TestCase
end end
def test_global_index def test_global_index
@request.session[:user_id] = 1
get :index get :index
assert_response :success assert_response :success
assert_template 'index' assert_template 'index'
assert_not_nil assigns(:events_by_day) assert_not_nil assigns(:events_by_day)
i5 = Issue.find(5)
d5 = User.find(1).time_to_date(i5.created_on)
assert_tag :tag => "h3", assert_tag :tag => "h3",
:content => /#{d5.day}/, :content => /#{5.day.ago.to_date.day}/,
:sibling => { :tag => "dl", :sibling => { :tag => "dl",
:child => { :tag => "dt", :child => { :tag => "dt",
:attributes => { :class => /issue/ }, :attributes => { :class => /issue/ },
+4 -23
View File
@@ -18,9 +18,7 @@
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, fixtures :projects, :users, :roles, :members, :member_roles, :enabled_modules, :documents, :enumerations
:enabled_modules, :documents, :enumerations,
:groups_users, :attachments
def setup def setup
User.current = nil User.current = nil
@@ -97,16 +95,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
with_settings :notified_events => %w(document_added) do post :create, :project_id => 'ecookbook',
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')
@@ -126,23 +124,6 @@ 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,14 +58,13 @@ 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
with_settings :notified_events => %w(file_added) do assert_difference 'Attachment.count' do
assert_difference 'Attachment.count' do post :create, :project_id => 1, :version_id => '',
post :create, :project_id => 1, :version_id => '', :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}}
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}} assert_response :redirect
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')
@@ -81,6 +80,7 @@ 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',
@@ -1371,7 +1371,6 @@ 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
@@ -71,14 +71,10 @@ class IssuesControllerTransactionTest < ActionController::TestCase
assert_response :success assert_response :success
assert_template 'edit' assert_template 'edit'
assert_tag 'div', :attributes => {:class => 'conflict'}
assert_select 'div.conflict' assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'overwrite'}
assert_select 'input[name=?][value=?]', 'conflict_resolution', 'overwrite' assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'add_notes'}
assert_select 'input[name=?][value=?]', 'conflict_resolution', 'add_notes' assert_tag 'input', :attributes => {:name => 'conflict_resolution', :value => 'cancel'}
assert_select 'label' do
assert_select 'input[name=?][value=?]', 'conflict_resolution', 'cancel'
assert_select 'a[href=/issues/2]'
end
end end
def test_update_stale_issue_should_save_attachments def test_update_stale_issue_should_save_attachments
+2 -3
View File
@@ -91,12 +91,11 @@ 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']
with_settings :notified_events => %w(message_posted) do post :new, :board_id => 1,
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}"
+3 -4
View File
@@ -82,13 +82,12 @@ class NewsControllerTest < ActionController::TestCase
def test_post_create def test_post_create
ActionMailer::Base.deliveries.clear ActionMailer::Base.deliveries.clear
@request.session[:user_id] = 2 Setting.notified_events << 'news_added'
with_settings :notified_events => %w(news_added) do @request.session[:user_id] = 2
post :create, :project_id => 1, :news => { :title => 'NewsControllerTest', 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')
@@ -412,10 +412,6 @@ class ProjectsControllerTest < ActionController::TestCase
assert_response :success assert_response :success
assert_template 'destroy' assert_template 'destroy'
assert_not_nil Project.find_by_id(1) assert_not_nil Project.find_by_id(1)
assert_tag :tag => 'strong',
:content => ['Private child of eCookbook',
'Child of private child, eCookbook Subproject 1',
'eCookbook Subproject 2'].join(', ')
end end
def test_destroy def test_destroy
@@ -287,53 +287,26 @@ 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
with_settings :diff_max_lines_displayed => 5 do # Truncated diff of changeset 2f9c0091
# Truncated diff of changeset 2f9c0091 with_cache do
with_cache do get :diff, :id => PRJ_ID, :type => 'inline',
get :diff, :id => PRJ_ID, :type => 'inline', :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' assert_response :success
assert_response :success assert @response.body.include?("... This diff was truncated")
assert @response.body.include?("... This diff was truncated")
with_settings :default_language => 'fr' do Setting.default_language = 'fr'
get :diff, :id => PRJ_ID, :type => 'inline', get :diff, :id => PRJ_ID, :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7' :rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
assert_response :success assert_response :success
assert ! @response.body.include?("... This diff was truncated") assert ! @response.body.include?("... This diff was truncated")
assert @response.body.include?("... Ce diff") assert @response.body.include?("... Ce diff")
end
end
end end
end end
@@ -57,7 +57,6 @@ 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,10 +33,6 @@ 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
@@ -96,16 +96,6 @@ class WelcomeControllerTest < ActionController::TestCase
assert @controller.respond_to?(:call_hook) assert @controller.respond_to?(:call_hook)
end end
def test_project_jump_box_should_escape_names_once
Project.find(1).update_attribute :name, 'Foo & Bar'
@request.session[:user_id] = 2
get :index
assert_select "#header select" do
assert_select "option", :text => 'Foo &amp; Bar'
end
end
context "test_api_offset_and_limit" do context "test_api_offset_and_limit" do
context "without params" do context "without params" do
should "return 0, 25" do should "return 0, 25" do
+3 -11
View File
@@ -495,19 +495,11 @@ class WikiControllerTest < ActionController::TestCase
end end
def test_diff def test_diff
content = WikiPage.find(1).content get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => 2, :version_from => 1
assert_difference 'WikiContent::Version.count', 2 do
content.text = "Line removed\nThis is a sample text for testing diffs"
content.save!
content.text = "This is a sample text for testing diffs\nLine added"
content.save!
end
get :diff, :project_id => 1, :id => 'CookBook_documentation', :version => content.version, :version_from => (content.version - 1)
assert_response :success assert_response :success
assert_template 'diff' assert_template 'diff'
assert_select 'span.diff_out', :text => 'Line removed' assert_tag :tag => 'span', :attributes => { :class => 'diff_in'},
assert_select 'span.diff_in', :text => 'Line added' :content => /updated/
end end
def test_annotate def test_annotate
+2
View File
@@ -66,6 +66,8 @@ class AccountTest < ActionController::IntegrationTest
assert_template 'my/page' assert_template 'my/page'
assert_equal user.id, session[:user_id] assert_equal user.id, session[:user_id]
assert_not_nil user.reload.last_login_on assert_not_nil user.reload.last_login_on
seconds_ago = 10.second.ago.utc
assert user.last_login_on.utc > 10.second.ago.utc, "#{user.last_login_on.utc} was not > #{seconds_ago}"
end end
def test_lost_password def test_lost_password
+4 -24
View File
@@ -140,11 +140,9 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/revisions/2457/diff" }, :path => "/projects/redmine/repository/revisions/2457/diff.diff" },
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', { :controller => 'repositories', :action => 'diff', :id => 'redmine',
:rev => '2457', :format => 'diff' }, :rev => '2457', :format => 'diff' }
{},
{ :format => 'diff' }
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
@@ -152,14 +150,6 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', { :controller => 'repositories', :action => 'diff', :id => 'redmine',
:path => @path_hash[:param], :rev => '2' } :path => @path_hash[:param], :rev => '2' }
) )
assert_routing(
{ :method => 'get',
:path => "/projects/redmine/repository/revisions/2/diff/#{@path_hash[:path]}" },
{ :controller => 'repositories', :action => 'diff', :id => 'redmine',
:path => @path_hash[:param], :rev => '2', :format => 'diff' },
{},
{ :format => 'diff' }
)
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" }, :path => "/projects/redmine/repository/revisions/2/entry/#{@path_hash[:path]}" },
@@ -219,11 +209,9 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/foo/revisions/2457/diff" }, :path => "/projects/redmine/repository/foo/revisions/2457/diff.diff" },
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
:rev => '2457', :format => 'diff' }, :rev => '2457', :format => 'diff' }
{},
{ :format => 'diff' }
) )
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
@@ -231,14 +219,6 @@ class RoutingRepositoriesTest < ActionController::IntegrationTest
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo', { :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
:path => @path_hash[:param], :rev => '2' } :path => @path_hash[:param], :rev => '2' }
) )
assert_routing(
{ :method => 'get',
:path => "/projects/redmine/repository/foo/revisions/2/diff/#{@path_hash[:path]}" },
{ :controller => 'repositories', :action => 'diff', :id => 'redmine', :repository_id => 'foo',
:path => @path_hash[:param], :rev => '2', :format => 'diff' },
{},
{ :format => 'diff' }
)
assert_routing( assert_routing(
{ :method => 'get', { :method => 'get',
:path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" }, :path => "/projects/redmine/repository/foo/revisions/2/entry/#{@path_hash[:path]}" },
-6
View File
@@ -75,12 +75,6 @@ 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"),
+3 -4
View File
@@ -33,12 +33,11 @@ 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)
with_settings :notified_events => %w(news_comment_added) do assert_difference 'ActionMailer::Base.deliveries.size' do
assert_difference 'ActionMailer::Base.deliveries.size' do Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment")
Comment.create!(:commented => @news, :author => @jsmith, :comments => "my comment")
end
end end
end end
+5 -9
View File
@@ -18,10 +18,7 @@
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'))
@@ -30,11 +27,10 @@ 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'
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'))
doc = Document.new(:project => Project.find(1), :title => 'New document', :category => Enumeration.find_by_name('User documentation'))
assert doc.save assert doc.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
+10 -34
View File
@@ -108,50 +108,26 @@ class IssuesHelperTest < ActionView::TestCase
end end
end end
def test_with_a_start_date_attribute_should_format_the_current_date context "with a start_date attribute" do
@detail = JournalDetail.new( should "format the current date" do
:property => 'attr', @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
: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) assert_match "01/31/2010", show_detail(@detail, true)
end end
end
def test_with_a_start_date_attribute_should_format_the_old_date should "format the old date" do
@detail = JournalDetail.new( @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'start_date')
: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) assert_match "01/01/2010", show_detail(@detail, true)
end end
end end
def test_with_a_due_date_attribute_should_with_a_due_date_attribute context "with a due_date attribute" do
@detail = JournalDetail.new( should "format the current date" do
:property => 'attr', @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
: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) assert_match "01/31/2010", show_detail(@detail, true)
end end
end
def test_with_a_due_date_attribute_should_format_the_old_date should "format the old date" do
@detail = JournalDetail.new( @detail = JournalDetail.new(:property => 'attr', :old_value => '2010-01-01', :value => '2010-01-31', :prop_key => 'due_date')
: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) assert_match "01/01/2010", show_detail(@detail, true)
end end
end end
+18 -27
View File
@@ -27,111 +27,102 @@ 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)
with_settings :notified_events => %w(issue_updated) do assert journal.save
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
with_settings :notified_events => %w(issue_updated) do assert journal.save
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)
with_settings :notified_events => [] do assert journal.save
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'
with_settings :notified_events => %w(issue_note_added) do assert journal.save
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'
with_settings :notified_events => [] do assert journal.save
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
with_settings :notified_events => %w(issue_status_updated) do assert issue.save
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
with_settings :notified_events => [] do assert issue.save
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
with_settings :notified_events => %w(issue_priority_updated) do assert issue.save
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
with_settings :notified_events => [] do assert issue.save
assert issue.save
end
assert_equal 0, ActionMailer::Base.deliveries.size assert_equal 0, ActionMailer::Base.deliveries.size
end end
end end
+2 -8
View File
@@ -18,14 +18,8 @@
require File.expand_path('../../../../test_helper', __FILE__) require File.expand_path('../../../../test_helper', __FILE__)
class Redmine::Hook::ManagerTest < ActionView::TestCase class Redmine::Hook::ManagerTest < ActionView::TestCase
fixtures :projects, :users, :members, :member_roles, :roles,
:groups_users, fixtures :issues
: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,7 +18,6 @@
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,6 +10,16 @@ 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.
@@ -19,16 +29,6 @@ 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
+1 -6
View File
@@ -35,10 +35,6 @@ 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'
@@ -386,8 +382,7 @@ 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
-10
View File
@@ -404,11 +404,6 @@ class MailerTest < ActiveSupport::TestCase
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do assert_difference 'ActionMailer::Base.deliveries.size' do
assert Mailer.wiki_content_added(content).deliver assert Mailer.wiki_content_added(content).deliver
assert_select_email do
assert_select 'a[href=?]',
'http://mydomain.foo/projects/ecookbook/wiki/CookBook_documentation',
:text => 'CookBook documentation'
end
end end
end end
end end
@@ -419,11 +414,6 @@ class MailerTest < ActiveSupport::TestCase
Setting.default_language = lang.to_s Setting.default_language = lang.to_s
assert_difference 'ActionMailer::Base.deliveries.size' do assert_difference 'ActionMailer::Base.deliveries.size' do
assert Mailer.wiki_content_updated(content).deliver assert Mailer.wiki_content_updated(content).deliver
assert_select_email do
assert_select 'a[href=?]',
'http://mydomain.foo/projects/ecookbook/wiki/CookBook_documentation',
:text => 'CookBook documentation'
end
end end
end end
end end
+2 -3
View File
@@ -29,11 +29,10 @@ 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)
with_settings :notified_events => %w(news_added) do assert news.save
assert news.save
end
assert_equal 1, ActionMailer::Base.deliveries.size assert_equal 1, ActionMailer::Base.deliveries.size
end end
-31
View File
@@ -18,8 +18,6 @@
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,
@@ -180,20 +178,6 @@ 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')
@@ -207,20 +191,6 @@ 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)
@@ -768,7 +738,6 @@ 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
+2 -12
View File
@@ -97,15 +97,6 @@ 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
repository = Repository.find(10) repository = Repository.find(10)
changesets = repository.changesets.count changesets = repository.changesets.count
@@ -149,6 +140,7 @@ 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(
@@ -165,9 +157,7 @@ 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
with_settings :notified_events => %w(issue_added issue_updated) do Repository.scan_changesets_for_issue_ids
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,10 +19,6 @@ 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?
+4 -8
View File
@@ -44,13 +44,11 @@ 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
@@ -90,13 +88,11 @@ 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