Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c393f1e92c |
2
Gemfile
2
Gemfile
@@ -14,7 +14,7 @@ end
|
||||
|
||||
# Optional gem for OpenID authentication
|
||||
group :openid do
|
||||
gem "ruby-openid", "~> 2.2.3", :require => "openid"
|
||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||
gem "rack-openid"
|
||||
end
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ class TimelogController < ApplicationController
|
||||
|
||||
def index
|
||||
@query = TimeEntryQuery.build_from_params(params, :project => @project, :name => '_')
|
||||
scope = time_entry_scope
|
||||
|
||||
sort_init(@query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.sort_criteria)
|
||||
sort_update(@query.sortable_columns)
|
||||
scope = time_entry_scope(:order => sort_clause)
|
||||
|
||||
respond_to do |format|
|
||||
format.html {
|
||||
@@ -55,6 +55,7 @@ class TimelogController < ApplicationController
|
||||
@entry_pages = Paginator.new @entry_count, per_page_option, params['page']
|
||||
@entries = scope.all(
|
||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||
:order => sort_clause,
|
||||
:limit => @entry_pages.per_page,
|
||||
:offset => @entry_pages.offset
|
||||
)
|
||||
@@ -67,13 +68,15 @@ class TimelogController < ApplicationController
|
||||
@offset, @limit = api_offset_and_limit
|
||||
@entries = scope.all(
|
||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||
:order => sort_clause,
|
||||
:limit => @limit,
|
||||
:offset => @offset
|
||||
)
|
||||
}
|
||||
format.atom {
|
||||
entries = scope.reorder("#{TimeEntry.table_name}.created_on DESC").all(
|
||||
entries = scope.all(
|
||||
:include => [:project, :activity, :user, {:issue => :tracker}],
|
||||
:order => "#{TimeEntry.table_name}.created_on DESC",
|
||||
:limit => Setting.feeds_limit.to_i
|
||||
)
|
||||
render_feed(entries, :title => l(:label_spent_time))
|
||||
@@ -81,7 +84,8 @@ class TimelogController < ApplicationController
|
||||
format.csv {
|
||||
# Export all entries
|
||||
@entries = scope.all(
|
||||
:include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}]
|
||||
:include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}],
|
||||
:order => sort_clause
|
||||
)
|
||||
send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'timelog.csv')
|
||||
}
|
||||
@@ -291,10 +295,12 @@ private
|
||||
end
|
||||
|
||||
# Returns the TimeEntry scope for index and report actions
|
||||
def time_entry_scope(options={})
|
||||
scope = @query.results_scope(options)
|
||||
def time_entry_scope
|
||||
scope = TimeEntry.visible.where(@query.statement)
|
||||
if @issue
|
||||
scope = scope.on_issue(@issue)
|
||||
elsif @project
|
||||
scope = scope.on_project(@project, Setting.display_subprojects_issues?)
|
||||
end
|
||||
scope
|
||||
end
|
||||
|
||||
@@ -214,28 +214,6 @@ module IssuesHelper
|
||||
out
|
||||
end
|
||||
|
||||
def email_issue_attributes(issue)
|
||||
items = []
|
||||
%w(author status priority assigned_to category fixed_version).each do |attribute|
|
||||
unless issue.disabled_core_fields.include?(attribute+"_id")
|
||||
items << "#{l("field_#{attribute}")}: #{issue.send attribute}"
|
||||
end
|
||||
end
|
||||
issue.custom_field_values.each do |value|
|
||||
items << "#{value.custom_field.name}: #{show_value(value)}"
|
||||
end
|
||||
items
|
||||
end
|
||||
|
||||
def render_email_issue_attributes(issue, html=false)
|
||||
items = email_issue_attributes(issue)
|
||||
if html
|
||||
content_tag('ul', items.map{|s| content_tag('li', s)}.join("\n").html_safe)
|
||||
else
|
||||
items.map{|s| "* #{s}"}.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the textual representation of a journal details
|
||||
# as an array of strings
|
||||
def details_to_strings(details, no_html=false, options={})
|
||||
|
||||
@@ -24,7 +24,7 @@ module ReportsHelper
|
||||
data.each { |row|
|
||||
match = 1
|
||||
criteria.each { |k, v|
|
||||
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k]))
|
||||
match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && row[k] == (v == 0 ? "f" : "t"))
|
||||
} unless criteria.nil?
|
||||
a = a + row["total"].to_i if match == 1
|
||||
} unless data.nil?
|
||||
|
||||
@@ -744,16 +744,12 @@ class Issue < ActiveRecord::Base
|
||||
initial_status = IssueStatus.find_by_id(status_id_was)
|
||||
end
|
||||
initial_status ||= status
|
||||
|
||||
initial_assigned_to_id = assigned_to_id_changed? ? assigned_to_id_was : assigned_to_id
|
||||
assignee_transitions_allowed = initial_assigned_to_id.present? &&
|
||||
(user.id == initial_assigned_to_id || user.group_ids.include?(initial_assigned_to_id))
|
||||
|
||||
|
||||
statuses = initial_status.find_new_statuses_allowed_to(
|
||||
user.admin ? Role.all : user.roles_for_project(project),
|
||||
tracker,
|
||||
author == user,
|
||||
assignee_transitions_allowed
|
||||
assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
|
||||
)
|
||||
statuses << initial_status unless statuses.empty?
|
||||
statuses << IssueStatus.default if include_default
|
||||
@@ -1337,8 +1333,7 @@ class Issue < ActiveRecord::Base
|
||||
if average == 0
|
||||
average = 1
|
||||
end
|
||||
done = p.leaves.sum("COALESCE(CASE WHEN estimated_hours > 0 THEN estimated_hours ELSE NULL END, #{average}) " +
|
||||
"* (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :joins => :status).to_f
|
||||
done = p.leaves.sum("COALESCE(estimated_hours, #{average}) * (CASE WHEN is_closed = #{connection.quoted_true} THEN 100 ELSE COALESCE(done_ratio, 0) END)", :joins => :status).to_f
|
||||
progress = done / (average * leaves_count)
|
||||
p.done_ratio = progress.round
|
||||
end
|
||||
|
||||
@@ -393,9 +393,10 @@ class IssueQuery < Query
|
||||
|
||||
if relation_options[:sym] == field && !options[:reverse]
|
||||
sqls = [sql, sql_for_relations(field, operator, value, :reverse => true)]
|
||||
sql = sqls.join(["!", "!*", "!p"].include?(operator) ? " AND " : " OR ")
|
||||
sqls.join(["!", "!*", "!p"].include?(operator) ? " AND " : " OR ")
|
||||
else
|
||||
sql
|
||||
end
|
||||
"(#{sql})"
|
||||
end
|
||||
|
||||
IssueRelation::TYPES.keys.each do |relation_type|
|
||||
|
||||
@@ -100,15 +100,6 @@ class TimeEntryQuery < Query
|
||||
@default_columns_names ||= [:project, :spent_on, :user, :activity, :issue, :comments, :hours]
|
||||
end
|
||||
|
||||
def results_scope(options={})
|
||||
order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?)
|
||||
|
||||
TimeEntry.visible.
|
||||
where(statement).
|
||||
order(order_option).
|
||||
joins(joins_for_order_statement(order_option.join(',')))
|
||||
end
|
||||
|
||||
# Accepts :from/:to params as shortcut filters
|
||||
def build_from_params(params)
|
||||
super
|
||||
|
||||
@@ -33,7 +33,7 @@ class UserPreference < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def [](attr_name)
|
||||
if has_attribute? attr_name
|
||||
if attribute_present? attr_name
|
||||
super
|
||||
else
|
||||
others ? others[attr_name] : nil
|
||||
@@ -41,7 +41,7 @@ class UserPreference < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def []=(attr_name, value)
|
||||
if has_attribute? attr_name
|
||||
if attribute_present? attr_name
|
||||
super
|
||||
else
|
||||
h = (read_attribute(:others) || {}).dup
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
<h1><%= link_to(h("#{issue.tracker.name} ##{issue.id}: #{issue.subject}"), issue_url) %></h1>
|
||||
|
||||
<%= render_email_issue_attributes(issue, true) %>
|
||||
<ul>
|
||||
<li><%=l(:field_author)%>: <%=h issue.author %></li>
|
||||
<li><%=l(:field_status)%>: <%=h issue.status %></li>
|
||||
<li><%=l(:field_priority)%>: <%=h issue.priority %></li>
|
||||
<li><%=l(:field_assigned_to)%>: <%=h issue.assigned_to %></li>
|
||||
<li><%=l(:field_category)%>: <%=h issue.category %></li>
|
||||
<li><%=l(:field_fixed_version)%>: <%=h issue.fixed_version %></li>
|
||||
<% issue.custom_field_values.each do |c| %>
|
||||
<li><%=h c.custom_field.name %>: <%=h show_value(c) %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<%= textilizable(issue, :description, :only_path => false) %>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<%= "#{issue.tracker.name} ##{issue.id}: #{issue.subject}" %>
|
||||
<%= issue_url %>
|
||||
|
||||
<%= render_email_issue_attributes(issue) %>
|
||||
* <%=l(:field_author)%>: <%= issue.author %>
|
||||
* <%=l(:field_status)%>: <%= issue.status %>
|
||||
* <%=l(:field_priority)%>: <%= issue.priority %>
|
||||
* <%=l(:field_assigned_to)%>: <%= issue.assigned_to %>
|
||||
* <%=l(:field_category)%>: <%= issue.category %>
|
||||
* <%=l(:field_fixed_version)%>: <%= issue.fixed_version %>
|
||||
<% issue.custom_field_values.each do |c| %>* <%= c.custom_field.name %>: <%= show_value(c) %>
|
||||
<% end -%>
|
||||
----------------------------------------
|
||||
<%= issue.description %>
|
||||
|
||||
@@ -1118,8 +1118,8 @@ es:
|
||||
permission_edit_documents: Editar documentos
|
||||
permission_delete_documents: Borrar documentos
|
||||
label_gantt_progress_line: Línea de progreso
|
||||
setting_jsonp_enabled: Habilitar soporte de JSONP
|
||||
field_inherit_members: Heredar miembros
|
||||
field_closed_on: Cerrada
|
||||
setting_default_projects_tracker_ids: Tipos de petición habilitados por defecto
|
||||
setting_jsonp_enabled: Enable JSONP support
|
||||
field_inherit_members: Inherit members
|
||||
field_closed_on: Closed
|
||||
setting_default_projects_tracker_ids: Default trackers for new projects
|
||||
label_total_time: Total
|
||||
|
||||
@@ -1091,5 +1091,5 @@ pt:
|
||||
setting_jsonp_enabled: Activar suporte JSONP
|
||||
field_inherit_members: Herdar membros
|
||||
field_closed_on: Fechado
|
||||
setting_default_projects_tracker_ids: Tipo de tarefa padrão para novos projectos
|
||||
setting_default_projects_tracker_ids: Default trackers for new projects
|
||||
label_total_time: Total
|
||||
|
||||
@@ -1080,17 +1080,17 @@ ru:
|
||||
label_between: между
|
||||
setting_issue_group_assignment: Разрешить назначение задач группам пользователей
|
||||
label_diff: Разница(diff)
|
||||
text_git_repository_note: Хранилище пустое и локальное (т.е. /gitrepo, c:\gitrepo)
|
||||
text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
|
||||
description_query_sort_criteria_direction: Порядок сортировки
|
||||
description_project_scope: Область поиска
|
||||
description_project_scope: Search scope
|
||||
description_filter: Фильтр
|
||||
description_user_mail_notification: Настройки почтовых оповещений
|
||||
description_date_from: Введите дату начала
|
||||
description_message_content: Содержание сообщения
|
||||
description_available_columns: Доступные столбцы
|
||||
description_date_range_interval: Выберите диапазон, установив дату начала и дату окончания
|
||||
description_issue_category_reassign: Выберите категорию задачи
|
||||
description_search: Поле поиска
|
||||
description_user_mail_notification: Mail notification settings
|
||||
description_date_from: Enter start date
|
||||
description_message_content: Message content
|
||||
description_available_columns: Available Columns
|
||||
description_date_range_interval: Choose range by selecting start and end date
|
||||
description_issue_category_reassign: Choose issue category
|
||||
description_search: Searchfield
|
||||
description_notes: Примечания
|
||||
description_date_range_list: Выберите диапазон из списка
|
||||
description_choose_project: Проекты
|
||||
@@ -1145,7 +1145,7 @@ ru:
|
||||
project_status_active: открытые
|
||||
project_status_closed: закрытые
|
||||
project_status_archived: архивированные
|
||||
text_project_closed: Проект закрыт и находится в режиме только для чтения.
|
||||
text_project_closed: Проект закрыт и находиться в режиме только для чтения.
|
||||
notice_user_successful_create: Пользователь %{id} создан.
|
||||
field_core_fields: Стандартные поля
|
||||
field_timeout: Таймаут (в секундах)
|
||||
|
||||
@@ -712,7 +712,7 @@
|
||||
label_nobody: 無名
|
||||
label_next: 下一頁
|
||||
label_previous: 上一頁
|
||||
label_used_by: 已使用專案
|
||||
label_used_by: Used by
|
||||
label_details: 明細
|
||||
label_add_note: 加入一個新筆記
|
||||
label_per_page: 每頁
|
||||
|
||||
@@ -4,27 +4,6 @@ Redmine - project management software
|
||||
Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||
http://www.redmine.org/
|
||||
|
||||
== 2013-09-14 v2.3.3
|
||||
|
||||
* Defect #13008: Usage of attribute_present? in UserPreference
|
||||
* Defect #14340: Autocomplete fields rendering issue with alternate theme
|
||||
* Defect #14366: Spent Time report sorting on custom fields causes error
|
||||
* Defect #14369: Open/closed issue counts on issues summary are not displayed with SQLServer
|
||||
* Defect #14401: Filtering issues on "related to" may ignore other filters
|
||||
* Defect #14415: Spent time details and report should ignore 'Setting.display_subprojects_issues?' when 'Subproject' filter is enabled.
|
||||
* Defect #14422: CVS root_url not recognized when connection string does not include port
|
||||
* Defect #14447: Additional status transitions for assignees do not work if assigned to a group
|
||||
* Defect #14511: warning: class variable access from toplevel on Ruby 2.0
|
||||
* Defect #14562: diff of CJK (Chinese/Japanese/Korean) is broken on Ruby 1.8
|
||||
* Defect #14584: Standard fields disabled for certain trackers still appear in email notifications
|
||||
* Defect #14607: rake redmine:load_default_data Error
|
||||
* Defect #14697: Wrong Russian translation in close project message
|
||||
* Defect #14798: Wrong done_ratio calculation for parent with subtask having estimated_hours=0
|
||||
* Patch #14485: Traditional Chinese translation for 2.3-stable
|
||||
* Patch #14502: Russian translation for 2.3-stable
|
||||
* Patch #14531: Spanish translations for 2.3.x
|
||||
* Patch #14686: Portuguese translation for 2.3-stable
|
||||
|
||||
== 2013-07-14 v2.3.2
|
||||
|
||||
* Defect #9996: configuration.yml in documentation , but redmine ask me to create email.yml
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
begin
|
||||
require 'zlib'
|
||||
@@__have_zlib = true
|
||||
rescue
|
||||
# Zlib not available
|
||||
@@__have_zlib = false
|
||||
end
|
||||
|
||||
require 'rexml/document'
|
||||
@@ -210,7 +211,7 @@ module SVG
|
||||
@doc.write( data, 0 )
|
||||
|
||||
if @config[:compress]
|
||||
if Object.const_defined?(:Zlib)
|
||||
if @@__have_zlib
|
||||
inp, out = IO.pipe
|
||||
gz = Zlib::GzipWriter.new( out )
|
||||
gz.write data
|
||||
|
||||
@@ -335,7 +335,7 @@ module Redmine
|
||||
# :pserver:anonymous@foo.bar:/path => /path
|
||||
# :ext:cvsservername:/path => /path
|
||||
def root_url_path
|
||||
root_url.to_s.gsub(%r{^:.+?(?=/)}, '')
|
||||
root_url.to_s.gsub(/^:.+:\d*/, '')
|
||||
end
|
||||
|
||||
# convert a date/time into the CVS-format
|
||||
|
||||
@@ -205,20 +205,12 @@ module Redmine
|
||||
end
|
||||
end
|
||||
ending = -1
|
||||
while ending >= -(max - starting) && (line_left[ending] == line_right[ending])
|
||||
while ending >= -(max - starting) && line_left[ending] == line_right[ending]
|
||||
ending -= 1
|
||||
end
|
||||
if (! "".respond_to?(:force_encoding)) && ending > (-1 * line_left.size)
|
||||
while line_left[ending].ord.between?(128, 255) && ending < -1
|
||||
if line_left[ending].ord.between?(128, 191)
|
||||
if line_left[ending + 1].ord.between?(128, 191)
|
||||
ending += 1
|
||||
else
|
||||
break
|
||||
end
|
||||
else
|
||||
ending += 1
|
||||
end
|
||||
while line_left[ending].ord.between?(128, 191) && ending > -1
|
||||
ending -= 1
|
||||
end
|
||||
end
|
||||
unless starting == 0 && ending == -1
|
||||
|
||||
@@ -4,7 +4,7 @@ module Redmine
|
||||
module VERSION #:nodoc:
|
||||
MAJOR = 2
|
||||
MINOR = 3
|
||||
TINY = 3
|
||||
TINY = 2
|
||||
|
||||
# Branch values:
|
||||
# * official release: nil
|
||||
|
||||
@@ -2,7 +2,6 @@ desc 'Load Redmine default configuration data. Language is chosen interactively
|
||||
|
||||
namespace :redmine do
|
||||
task :load_default_data => :environment do
|
||||
require 'custom_field'
|
||||
include Redmine::I18n
|
||||
set_language_if_valid('en')
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@ table.members td.group { padding-left: 20px; background: url(../images/group.png
|
||||
input#principal_search, input#user_search {width:90%}
|
||||
|
||||
input.autocomplete {
|
||||
background: #fff url(../images/magnifier.png) no-repeat 2px 50%; padding-left:20px !important;
|
||||
background: #fff url(../images/magnifier.png) no-repeat 2px 50%; padding-left:20px;
|
||||
border:1px solid #9EB1C2; border-radius:2px; height:1.5em;
|
||||
}
|
||||
input.autocomplete.ajax-loading {
|
||||
|
||||
7
test/fixtures/diffs/issue-13644-3.diff
vendored
7
test/fixtures/diffs/issue-13644-3.diff
vendored
@@ -1,7 +0,0 @@
|
||||
--- a.txt 2013-07-27 06:03:49.133257759 +0900
|
||||
+++ b.txt 2013-07-27 06:03:58.791221118 +0900
|
||||
@@ -1,3 +1,3 @@
|
||||
aaaa
|
||||
-日本記
|
||||
+日本娘
|
||||
bbbb
|
||||
7
test/fixtures/diffs/issue-13644-4.diff
vendored
7
test/fixtures/diffs/issue-13644-4.diff
vendored
@@ -1,7 +0,0 @@
|
||||
--- a.txt 2013-07-27 04:20:45.973229414 +0900
|
||||
+++ b.txt 2013-07-27 04:20:52.366228105 +0900
|
||||
@@ -1,3 +1,3 @@
|
||||
aaaa
|
||||
-日本記
|
||||
+日本誘
|
||||
bbbb
|
||||
7
test/fixtures/diffs/issue-13644-5.diff
vendored
7
test/fixtures/diffs/issue-13644-5.diff
vendored
@@ -1,7 +0,0 @@
|
||||
--- a.txt 2013-07-27 05:52:11.415223830 +0900
|
||||
+++ b.txt 2013-07-27 05:52:18.249190358 +0900
|
||||
@@ -1,3 +1,3 @@
|
||||
aaaa
|
||||
-日本記ok
|
||||
+日本誘ok
|
||||
bbbb
|
||||
@@ -209,7 +209,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
project = assigns(:project)
|
||||
assert_kind_of Project, project
|
||||
assert_not_equal [], project.errors[:parent_id]
|
||||
assert_not_nil project.errors[:parent_id]
|
||||
end
|
||||
|
||||
test "#create by non-admin user with add_subprojects permission should create a project with a parent_id" do
|
||||
@@ -244,7 +244,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
project = assigns(:project)
|
||||
assert_kind_of Project, project
|
||||
assert_not_equal [], project.errors[:parent_id]
|
||||
assert_not_nil project.errors[:parent_id]
|
||||
end
|
||||
|
||||
test "#create by non-admin user with add_subprojects permission should fail with unauthorized parent_id" do
|
||||
@@ -265,7 +265,7 @@ class ProjectsControllerTest < ActionController::TestCase
|
||||
assert_response :success
|
||||
project = assigns(:project)
|
||||
assert_kind_of Project, project
|
||||
assert_not_equal [], project.errors[:parent_id]
|
||||
assert_not_nil project.errors[:parent_id]
|
||||
end
|
||||
|
||||
def test_create_subproject_with_inherit_members_should_inherit_members
|
||||
|
||||
@@ -54,24 +54,6 @@ class ReportsControllerTest < ActionController::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_get_issue_report_details_by_tracker_should_show_issue_count
|
||||
Issue.delete_all
|
||||
Issue.generate!(:tracker_id => 1)
|
||||
Issue.generate!(:tracker_id => 1)
|
||||
Issue.generate!(:tracker_id => 1, :status_id => 5)
|
||||
Issue.generate!(:tracker_id => 2)
|
||||
|
||||
get :issue_report_details, :id => 1, :detail => 'tracker'
|
||||
assert_select 'table.list tbody :nth-child(1)' do
|
||||
assert_select 'td', :text => 'Bug'
|
||||
assert_select ':nth-child(2)', :text => '2' # status:1
|
||||
assert_select ':nth-child(3)', :text => '-' # status:2
|
||||
assert_select ':nth-child(8)', :text => '2' # open
|
||||
assert_select ':nth-child(9)', :text => '1' # closed
|
||||
assert_select ':nth-child(10)', :text => '3' # total
|
||||
end
|
||||
end
|
||||
|
||||
def test_get_issue_report_details_by_priority
|
||||
get :issue_report_details, :id => 1, :detail => 'priority'
|
||||
assert_equal IssuePriority.all.reverse, assigns(:rows)
|
||||
|
||||
@@ -443,28 +443,6 @@ class TimelogControllerTest < ActionController::TestCase
|
||||
:attributes => {:action => "/projects/ecookbook/time_entries", :id => 'query_form'}
|
||||
end
|
||||
|
||||
def test_index_with_display_subprojects_issues_to_false_should_not_include_subproject_entries
|
||||
entry = TimeEntry.generate!(:project => Project.find(3))
|
||||
|
||||
with_settings :display_subprojects_issues => '0' do
|
||||
get :index, :project_id => 'ecookbook'
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_not_include entry, assigns(:entries)
|
||||
end
|
||||
end
|
||||
|
||||
def test_index_with_display_subprojects_issues_to_false_and_subproject_filter_should_include_subproject_entries
|
||||
entry = TimeEntry.generate!(:project => Project.find(3))
|
||||
|
||||
with_settings :display_subprojects_issues => '0' do
|
||||
get :index, :project_id => 'ecookbook', :subproject_id => 3
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
assert_include entry, assigns(:entries)
|
||||
end
|
||||
end
|
||||
|
||||
def test_index_at_project_level_with_date_range
|
||||
get :index, :project_id => 'ecookbook',
|
||||
:f => ['spent_on'],
|
||||
@@ -562,24 +540,6 @@ class TimelogControllerTest < ActionController::TestCase
|
||||
assert_select 'td.issue_cf_2', :text => 'filter_on_issue_custom_field'
|
||||
end
|
||||
|
||||
def test_index_with_time_entry_custom_field_sorting
|
||||
field = TimeEntryCustomField.generate!(:field_format => 'string', :name => 'String Field')
|
||||
TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 1'})
|
||||
TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 3'})
|
||||
TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value 2'})
|
||||
field_name = "cf_#{field.id}"
|
||||
|
||||
get :index, :c => ["hours", field_name], :sort => field_name
|
||||
assert_response :success
|
||||
assert_include field_name.to_sym, assigns(:query).column_names
|
||||
assert_select "th a.sort", :text => 'String Field'
|
||||
|
||||
# Make sure that values are properly sorted
|
||||
values = assigns(:entries).map {|e| e.custom_field_value(field)}.compact
|
||||
assert_equal 3, values.size
|
||||
assert_equal values.sort, values
|
||||
end
|
||||
|
||||
def test_index_atom_feed
|
||||
get :index, :project_id => 1, :format => 'atom'
|
||||
assert_response :success
|
||||
|
||||
@@ -93,7 +93,7 @@ class AttachmentTest < ActiveSupport::TestCase
|
||||
def test_description_length_should_be_validated
|
||||
a = Attachment.new(:description => 'a' * 300)
|
||||
assert !a.save
|
||||
assert_not_equal [], a.errors[:description]
|
||||
assert_not_nil a.errors[:description]
|
||||
end
|
||||
|
||||
def test_destroy
|
||||
|
||||
@@ -57,7 +57,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase
|
||||
child = Issue.new(:project_id => 2, :tracker_id => 1, :author_id => 1,
|
||||
:subject => 'child', :parent_issue_id => issue.id)
|
||||
assert !child.save
|
||||
assert_not_equal [], child.errors[:parent_issue_id]
|
||||
assert_not_nil child.errors[:parent_issue_id]
|
||||
end
|
||||
|
||||
def test_move_a_root_to_child
|
||||
@@ -163,7 +163,7 @@ class IssueNestedSetTest < ActiveSupport::TestCase
|
||||
child.reload
|
||||
child.parent_issue_id = grandchild.id
|
||||
assert !child.save
|
||||
assert_not_equal [], child.errors[:parent_issue_id]
|
||||
assert_not_nil child.errors[:parent_issue_id]
|
||||
end
|
||||
|
||||
def test_destroy_should_destroy_children
|
||||
@@ -302,17 +302,6 @@ class IssueNestedSetTest < ActiveSupport::TestCase
|
||||
assert_equal (50 * 20 + 20 * 10) / 30, parent.reload.done_ratio
|
||||
end
|
||||
|
||||
def test_parent_done_ratio_with_child_estimate_to_0_should_reach_100
|
||||
parent = Issue.generate!
|
||||
issue1 = Issue.generate!(:parent_issue_id => parent.id)
|
||||
issue2 = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 0)
|
||||
assert_equal 0, parent.reload.done_ratio
|
||||
issue1.reload.update_attribute :status_id, 5
|
||||
assert_equal 50, parent.reload.done_ratio
|
||||
issue2.reload.update_attribute :status_id, 5
|
||||
assert_equal 100, parent.reload.done_ratio
|
||||
end
|
||||
|
||||
def test_parent_estimate_should_be_sum_of_leaves
|
||||
parent = Issue.generate!
|
||||
Issue.generate!(:estimated_hours => nil, :parent_issue_id => parent.id)
|
||||
|
||||
@@ -114,7 +114,7 @@ class IssueRelationTest < ActiveSupport::TestCase
|
||||
:relation_type => IssueRelation::TYPE_PRECEDES
|
||||
)
|
||||
assert !r.save
|
||||
assert_not_equal [], r.errors[:base]
|
||||
assert_not_nil r.errors[:base]
|
||||
end
|
||||
|
||||
def test_validates_circular_dependency_of_subtask
|
||||
@@ -165,6 +165,6 @@ class IssueRelationTest < ActiveSupport::TestCase
|
||||
:relation_type => IssueRelation::TYPE_BLOCKED
|
||||
)
|
||||
assert !r.save
|
||||
assert_not_equal [], r.errors[:base]
|
||||
assert_not_nil r.errors[:base]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -469,7 +469,7 @@ class IssueTest < ActiveSupport::TestCase
|
||||
issue.tracker_id = 2
|
||||
issue.subject = 'New subject'
|
||||
assert !issue.save
|
||||
assert_not_equal [], issue.errors[:tracker_id]
|
||||
assert_not_nil issue.errors[:tracker_id]
|
||||
end
|
||||
|
||||
def test_category_based_assignment
|
||||
@@ -488,9 +488,9 @@ class IssueTest < ActiveSupport::TestCase
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 3,
|
||||
:author => true, :assignee => false)
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 4,
|
||||
:author => false, :assignee => true)
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1, :old_status_id => 1,
|
||||
:new_status_id => 4, :author => false,
|
||||
:assignee => true)
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 5,
|
||||
:author => true, :assignee => true)
|
||||
@@ -516,26 +516,6 @@ class IssueTest < ActiveSupport::TestCase
|
||||
:project_id => 1, :author => user,
|
||||
:assigned_to => user)
|
||||
assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
|
||||
|
||||
group = Group.generate!
|
||||
group.users << user
|
||||
issue = Issue.generate!(:tracker => tracker, :status => status,
|
||||
:project_id => 1, :author => user,
|
||||
:assigned_to => group)
|
||||
assert_equal [1, 2, 3, 4, 5], issue.new_statuses_allowed_to(user).map(&:id)
|
||||
end
|
||||
|
||||
def test_new_statuses_allowed_to_should_consider_group_assignment
|
||||
WorkflowTransition.delete_all
|
||||
WorkflowTransition.create!(:role_id => 1, :tracker_id => 1,
|
||||
:old_status_id => 1, :new_status_id => 4,
|
||||
:author => false, :assignee => true)
|
||||
user = User.find(2)
|
||||
group = Group.generate!
|
||||
group.users << user
|
||||
|
||||
issue = Issue.generate!(:author_id => 1, :assigned_to => group)
|
||||
assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
|
||||
end
|
||||
|
||||
def test_new_statuses_allowed_to_should_return_all_transitions_for_admin
|
||||
@@ -1024,7 +1004,7 @@ class IssueTest < ActiveSupport::TestCase
|
||||
:status_id => 1, :fixed_version_id => 1,
|
||||
:subject => 'New issue')
|
||||
assert !issue.save
|
||||
assert_not_equal [], issue.errors[:fixed_version_id]
|
||||
assert_not_nil issue.errors[:fixed_version_id]
|
||||
end
|
||||
|
||||
def test_should_not_be_able_to_assign_a_new_issue_to_a_locked_version
|
||||
@@ -1032,7 +1012,7 @@ class IssueTest < ActiveSupport::TestCase
|
||||
:status_id => 1, :fixed_version_id => 2,
|
||||
:subject => 'New issue')
|
||||
assert !issue.save
|
||||
assert_not_equal [], issue.errors[:fixed_version_id]
|
||||
assert_not_nil issue.errors[:fixed_version_id]
|
||||
end
|
||||
|
||||
def test_should_be_able_to_assign_a_new_issue_to_an_open_version
|
||||
@@ -1053,7 +1033,7 @@ class IssueTest < ActiveSupport::TestCase
|
||||
issue = Issue.find(11)
|
||||
issue.status_id = 1
|
||||
assert !issue.save
|
||||
assert_not_equal [], issue.errors[:base]
|
||||
assert_not_nil issue.errors[:base]
|
||||
end
|
||||
|
||||
def test_should_be_able_to_reopen_and_reassign_an_issue_assigned_to_a_closed_version
|
||||
|
||||
@@ -79,22 +79,6 @@ begin
|
||||
assert_equal "UTF-8", adpt2.path_encoding
|
||||
end
|
||||
|
||||
def test_root_url_path
|
||||
to_test = {
|
||||
':pserver:cvs_user:cvs_password@123.456.789.123:9876/repo' => '/repo',
|
||||
':pserver:cvs_user:cvs_password@123.456.789.123/repo' => '/repo',
|
||||
':pserver:cvs_user:cvs_password@cvs_server:/repo' => '/repo',
|
||||
':pserver:cvs_user:cvs_password@cvs_server:9876/repo' => '/repo',
|
||||
':pserver:cvs_user:cvs_password@cvs_server/repo' => '/repo',
|
||||
':pserver:cvs_user:cvs_password@cvs_server/path/repo' => '/path/repo',
|
||||
':ext:cvsservername:/path' => '/path'
|
||||
}
|
||||
|
||||
to_test.each do |string, expected|
|
||||
assert_equal expected, Redmine::Scm::Adapters::CvsAdapter.new('foo', string).send(:root_url_path), "#{string} failed"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def test_scm_version_for(scm_command_version, version)
|
||||
|
||||
@@ -308,54 +308,6 @@ DIFF
|
||||
end
|
||||
end
|
||||
|
||||
def test_offset_range_japanese_3
|
||||
# UTF-8 The 1st byte differs.
|
||||
ja1 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe8\xa8\x98</span>"
|
||||
ja1.force_encoding('UTF-8') if ja1.respond_to?(:force_encoding)
|
||||
ja2 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe5\xa8\x98</span>"
|
||||
ja2.force_encoding('UTF-8') if ja2.respond_to?(:force_encoding)
|
||||
with_settings :repositories_encodings => '' do
|
||||
diff = Redmine::UnifiedDiff.new(
|
||||
read_diff_fixture('issue-13644-3.diff'), :type => 'sbs')
|
||||
assert_equal 1, diff.size
|
||||
assert_equal 3, diff.first.size
|
||||
assert_equal ja1, diff.first[1].html_line_left
|
||||
assert_equal ja2, diff.first[1].html_line_right
|
||||
end
|
||||
end
|
||||
|
||||
def test_offset_range_japanese_4
|
||||
# UTF-8 The 2nd byte differs.
|
||||
ja1 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe8\xa8\x98</span>"
|
||||
ja1.force_encoding('UTF-8') if ja1.respond_to?(:force_encoding)
|
||||
ja2 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe8\xaa\x98</span>"
|
||||
ja2.force_encoding('UTF-8') if ja2.respond_to?(:force_encoding)
|
||||
with_settings :repositories_encodings => '' do
|
||||
diff = Redmine::UnifiedDiff.new(
|
||||
read_diff_fixture('issue-13644-4.diff'), :type => 'sbs')
|
||||
assert_equal 1, diff.size
|
||||
assert_equal 3, diff.first.size
|
||||
assert_equal ja1, diff.first[1].html_line_left
|
||||
assert_equal ja2, diff.first[1].html_line_right
|
||||
end
|
||||
end
|
||||
|
||||
def test_offset_range_japanese_5
|
||||
# UTF-8 The 2nd byte differs.
|
||||
ja1 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe8\xa8\x98</span>ok"
|
||||
ja1.force_encoding('UTF-8') if ja1.respond_to?(:force_encoding)
|
||||
ja2 = "\xe6\x97\xa5\xe6\x9c\xac<span>\xe8\xaa\x98</span>ok"
|
||||
ja2.force_encoding('UTF-8') if ja2.respond_to?(:force_encoding)
|
||||
with_settings :repositories_encodings => '' do
|
||||
diff = Redmine::UnifiedDiff.new(
|
||||
read_diff_fixture('issue-13644-5.diff'), :type => 'sbs')
|
||||
assert_equal 1, diff.size
|
||||
assert_equal 3, diff.first.size
|
||||
assert_equal ja1, diff.first[1].html_line_left
|
||||
assert_equal ja2, diff.first[1].html_line_right
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def read_diff_fixture(filename)
|
||||
|
||||
@@ -315,29 +315,6 @@ class MailerTest < ActiveSupport::TestCase
|
||||
assert !last_email.bcc.include?(user.mail)
|
||||
end
|
||||
|
||||
def test_issue_add_should_include_enabled_fields
|
||||
Setting.default_language = 'en'
|
||||
issue = Issue.find(2)
|
||||
assert Mailer.deliver_issue_add(issue)
|
||||
assert_mail_body_match '* Target version: 1.0', last_email
|
||||
assert_select_email do
|
||||
assert_select 'li', :text => 'Target version: 1.0'
|
||||
end
|
||||
end
|
||||
|
||||
def test_issue_add_should_not_include_disabled_fields
|
||||
Setting.default_language = 'en'
|
||||
issue = Issue.find(2)
|
||||
tracker = issue.tracker
|
||||
tracker.core_fields -= ['fixed_version_id']
|
||||
tracker.save!
|
||||
assert Mailer.deliver_issue_add(issue)
|
||||
assert_mail_body_no_match 'Target version', last_email
|
||||
assert_select_email do
|
||||
assert_select 'li', :text => /Target version/, :count => 0
|
||||
end
|
||||
end
|
||||
|
||||
# test mailer methods for each language
|
||||
def test_issue_add
|
||||
issue = Issue.find(1)
|
||||
|
||||
@@ -746,21 +746,6 @@ class QueryTest < ActiveSupport::TestCase
|
||||
assert_equal [1, 2, 3], find_issues_with_query(query).map(&:id).sort
|
||||
end
|
||||
|
||||
def test_filter_on_relations_should_not_ignore_other_filter
|
||||
issue = Issue.generate!
|
||||
issue1 = Issue.generate!(:status_id => 1)
|
||||
issue2 = Issue.generate!(:status_id => 2)
|
||||
IssueRelation.create!(:relation_type => "relates", :issue_from => issue, :issue_to => issue1)
|
||||
IssueRelation.create!(:relation_type => "relates", :issue_from => issue, :issue_to => issue2)
|
||||
|
||||
query = IssueQuery.new(:name => '_')
|
||||
query.filters = {
|
||||
"status_id" => {:operator => '=', :values => ['1']},
|
||||
"relates" => {:operator => '=', :values => [issue.id.to_s]}
|
||||
}
|
||||
assert_equal [issue1], find_issues_with_query(query)
|
||||
end
|
||||
|
||||
def test_statement_should_be_nil_with_no_filters
|
||||
q = IssueQuery.new(:name => '_')
|
||||
q.filters = {}
|
||||
|
||||
@@ -55,11 +55,6 @@ class UserPreferenceTest < ActiveSupport::TestCase
|
||||
assert_kind_of Hash, up.others
|
||||
end
|
||||
|
||||
def test_others_should_be_blank_after_initialization
|
||||
pref = User.new.pref
|
||||
assert_equal({}, pref.others)
|
||||
end
|
||||
|
||||
def test_reading_value_from_nil_others_hash
|
||||
up = UserPreference.new(:user => User.new)
|
||||
up.others = nil
|
||||
|
||||
@@ -366,7 +366,7 @@ class UserTest < ActiveSupport::TestCase
|
||||
u = User.new
|
||||
u.mail_notification = 'foo'
|
||||
u.save
|
||||
assert_not_equal [], u.errors[:mail_notification]
|
||||
assert_not_nil u.errors[:mail_notification]
|
||||
end
|
||||
|
||||
context "User#try_to_login" do
|
||||
|
||||
Reference in New Issue
Block a user