Compare commits

..

1 Commits
2.1.3 ... 2.1.0

Author SHA1 Message Date
Jean-Philippe Lang
2a4774627d tagged version 2.1.0
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/tags/2.1.0@10395 e93f8b46-1217-0410-a6f0-8f06a7374b81
2012-09-16 12:47:11 +00:00
52 changed files with 178 additions and 491 deletions

1
.gitignore vendored
View File

@@ -19,7 +19,6 @@
/public/plugin_assets
/tmp/*
/tmp/cache/*
/tmp/pdf/*
/tmp/sessions/*
/tmp/sockets/*
/tmp/test/*

View File

@@ -21,7 +21,6 @@ public/dispatch.*
public/plugin_assets
tmp/*
tmp/cache/*
tmp/pdf/*
tmp/sessions/*
tmp/sockets/*
tmp/test/*

View File

@@ -238,7 +238,7 @@ class AccountController < ApplicationController
def onthefly_creation_failed(user, auth_source_options = { })
@user = user
session[:auth_source_registration] = auth_source_options unless auth_source_options.empty?
render :action => 'register'
render register_path
end
def invalid_credentials

View File

@@ -398,7 +398,7 @@ private
end
@issue.project = @project
@issue.author ||= User.current
@issue.author = User.current
# Tracker must be set before custom field values
@issue.tracker ||= @project.trackers.find((params[:issue] && params[:issue][:tracker_id]) || params[:tracker_id] || :first)
if @issue.tracker.nil?

View File

@@ -795,10 +795,11 @@ module ApplicationHelper
if repository && User.current.allowed_to?(:browse_repository, project)
name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$}
path, rev, anchor = $1, $3, $5
link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => (prefix == 'export' ? 'raw' : 'entry'), :id => project, :repository_id => repository.identifier_param,
link = link_to h("#{project_prefix}#{prefix}:#{repo_prefix}#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, :repository_id => repository.identifier_param,
:path => to_path_param(path),
:rev => rev,
:anchor => anchor},
:anchor => anchor,
:format => (prefix == 'export' ? 'raw' : nil)},
:class => (prefix == 'export' ? 'source download' : 'source')
end
end
@@ -1028,11 +1029,6 @@ module ApplicationHelper
content_tag(:a, name, {:href => '#', :onclick => "#{function}; return false;"}.merge(html_options))
end
# Helper to render JSON in views
def raw_json(arg)
arg.to_json.to_s.gsub('/', '\/').html_safe
end
def back_url
url = params[:back_url]
if url.nil? && referer = request.env['HTTP_REFERER']

View File

@@ -26,8 +26,8 @@ module ContextMenusHelper
end
if options.delete(:disabled)
options.delete(:method)
options.delete(:data)
options[:onclick] = 'return false;'
options.delete(:confirm)
options.delete(:onclick)
options[:class] << ' disabled'
url = '#'
end

View File

@@ -84,21 +84,17 @@ class Issue < ActiveRecord::Base
# Returns a SQL conditions string used to find all issues visible by the specified user
def self.visible_condition(user, options={})
Project.allowed_to_condition(user, :view_issues, options) do |role, user|
if user.logged?
case role.issues_visibility
when 'all'
nil
when 'default'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else
'1=0'
end
case role.issues_visibility
when 'all'
nil
when 'default'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.is_private = #{connection.quoted_false} OR #{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
when 'own'
user_ids = [user.id] + user.groups.map(&:id)
"(#{table_name}.author_id = #{user.id} OR #{table_name}.assigned_to_id IN (#{user_ids.join(',')}))"
else
"(#{table_name}.is_private = #{connection.quoted_false})"
'1=0'
end
end
end
@@ -106,19 +102,15 @@ class Issue < ActiveRecord::Base
# Returns true if usr or current user is allowed to view the issue
def visible?(usr=nil)
(usr || User.current).allowed_to?(:view_issues, self.project) do |role, user|
if user.logged?
case role.issues_visibility
when 'all'
true
when 'default'
!self.is_private? || (self.author == user || user.is_or_belongs_to?(assigned_to))
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
else
false
end
case role.issues_visibility
when 'all'
true
when 'default'
!self.is_private? || self.author == user || user.is_or_belongs_to?(assigned_to)
when 'own'
self.author == user || user.is_or_belongs_to?(assigned_to)
else
!self.is_private?
false
end
end
end

View File

@@ -373,8 +373,7 @@ class MailHandler < ActionMailer::Base
# try to reencode to utf8 manually with ruby1.8
begin
if h = email.header[:subject]
# http://tools.ietf.org/html/rfc2047#section-4
if m = h.value.match(/=\?([^\?]+)\?[BbQq]\?/)
if m = h.value.match(/^=\?([^\?]+)\?/)
subject = Redmine::CodesetUtil.to_utf8(subject, m[1])
end
end

View File

@@ -30,13 +30,13 @@ class Principal < ActiveRecord::Base
if q.blank?
{}
else
q = q.to_s
q = q.to_s.downcase
pattern = "%#{q}%"
sql = "LOWER(login) LIKE LOWER(:p) OR LOWER(firstname) LIKE LOWER(:p) OR LOWER(lastname) LIKE LOWER(:p) OR LOWER(mail) LIKE LOWER(:p)"
sql = "LOWER(login) LIKE :p OR LOWER(firstname) LIKE :p OR LOWER(lastname) LIKE :p OR LOWER(mail) LIKE :p"
params = {:p => pattern}
if q =~ /^(.+)\s+(.+)$/
a, b = "#{$1}%", "#{$2}%"
sql << " OR (LOWER(firstname) LIKE LOWER(:a) AND LOWER(lastname) LIKE LOWER(:b)) OR (LOWER(firstname) LIKE LOWER(:b) AND LOWER(lastname) LIKE LOWER(:a))"
sql << " OR (LOWER(firstname) LIKE :a AND LOWER(lastname) LIKE :b) OR (LOWER(firstname) LIKE :b AND LOWER(lastname) LIKE :a)"
params.merge!(:a => a, :b => b)
end
{:conditions => [sql, params]}

View File

@@ -133,11 +133,6 @@ class Role < ActiveRecord::Base
self.builtin != 0
end
# Return true if the role is the anonymous role
def anonymous?
builtin == 2
end
# Return true if the role is a project member role
def member?
!self.builtin?

View File

@@ -44,7 +44,7 @@ class UserPreference < ActiveRecord::Base
if attribute_present? attr_name
super
else
h = (read_attribute(:others) || {}).dup
h = read_attribute(:others).dup || {}
h.update(attr_name => value)
write_attribute(:others, h)
value

View File

@@ -33,7 +33,6 @@ class Version < ActiveRecord::Base
validates_format_of :effective_date, :with => /^\d{4}-\d{2}-\d{2}$/, :message => :not_a_date, :allow_nil => true
validates_inclusion_of :status, :in => VERSION_STATUSES
validates_inclusion_of :sharing, :in => VERSION_SHARINGS
validate :validate_version
scope :named, lambda {|arg| { :conditions => ["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip]}}
scope :open, :conditions => {:status => 'open'}
@@ -276,10 +275,4 @@ class Version < ActiveRecord::Base
progress
end
end
def validate_version
if effective_date.nil? && @attributes['effective_date'].present?
errors.add :effective_date, :not_a_date
end
end
end

View File

@@ -3,6 +3,6 @@
<% if @message.present? %>
<p id="errorExplanation"><%=h @message %></p>
<% end %>
<p><a href="javascript:history.back()"><%= l(:button_back) %></a></p>
<p><a href="javascript:history.back()">Back</a></p>
<% html_title @status %>

View File

@@ -6,7 +6,7 @@
<%= l(:field_delay) %>: <%= f.text_field :delay, :size => 3 %> <%= l(:label_day_plural) %>
</span>
<%= submit_tag l(:button_add) %>
<%= link_to_function l(:button_cancel), '$("#new-relation-form").hide();'%>
<%= toggle_link l(:button_cancel), 'new-relation-form'%>
</p>
<%= javascript_tag "observeAutocompleteField('relation_issue_to_id', '#{escape_javascript auto_complete_issues_path(:project_id => @project, :scope => (Setting.cross_project_issue_relations? ? 'all' : nil))}')" %>

View File

@@ -19,7 +19,7 @@
<tr class="group open">
<td colspan="<%= query.columns.size + 2 %>">
<span class="expander" onclick="toggleRowGroup(this);">&nbsp;</span>
<%= group.blank? ? l(:label_none) : column_content(@query.group_by_column, issue) %> <span class="count">(<%= @issue_count_by_group[group] %>)</span>
<%= group.blank? ? 'None' : column_content(@query.group_by_column, issue) %> <span class="count">(<%= @issue_count_by_group[group] %>)</span>
<%= link_to_function("#{l(:button_collapse_all)}/#{l(:button_expand_all)}", "toggleAllRowGroups(this)", :class => 'toggle-all') %>
</td>
</tr>

View File

@@ -1,12 +1,12 @@
<%= javascript_tag do %>
var operatorLabels = <%= raw_json Query.operators_labels %>;
var operatorByType = <%= raw_json Query.operators_by_filter_type %>;
var availableFilters = <%= raw_json query.available_filters_as_json %>;
var labelDayPlural = <%= raw_json l(:label_day_plural) %>;
var operatorLabels = <%= raw Query.operators_labels.to_json %>;
var operatorByType = <%= raw Query.operators_by_filter_type.to_json %>;
var availableFilters = <%= raw query.available_filters_as_json.to_json %>;
var labelDayPlural = "<%= raw escape_javascript(l(:label_day_plural)) %>";
$(document).ready(function(){
initFilters();
<% query.filters.each do |field, options| %>
addFilter("<%= field %>", <%= raw_json query.operator_for(field) %>, <%= raw_json query.values_for(field) %>);
addFilter("<%= field %>", <%= raw query.operator_for(field).to_json %>, <%= raw query.values_for(field).to_json %>);
<% end %>
});
<% end %>

View File

@@ -1,9 +1,8 @@
<h2><%= l(:label_revision) %> <%= @diff_format_revisions %> <%=h @path %></h2>
<!-- Choose view type -->
<%= form_tag({:action => 'diff', :id => @project,
:repository_id => @repository.identifier_param,
:path => to_path_param(@path), :rev=> @rev}, :method => 'get') do %>
<%= form_tag({:path => to_path_param(@path)}, :method => 'get') do %>
<%= hidden_field_tag('rev', params[:rev]) if params[:rev] %>
<%= hidden_field_tag('rev_to', params[:rev_to]) if params[:rev_to] %>
<p>
<label><%= l(:label_view_diff) %></label>

View File

@@ -1,8 +1,7 @@
<div class="contextual">
<%= form_tag(
{:controller => 'repositories', :action => 'revision', :id => @project,
:repository_id => @repository.identifier_param},
:method => :get
:repository_id => @repository.identifier_param}
) do %>
<%= l(:label_revision) %>: <%= text_field_tag 'rev', @rev, :size => 8 %>
<%= submit_tag 'OK' %>

View File

@@ -1,6 +1,5 @@
<%= error_messages_for 'role' %>
<% unless @role.anonymous? %>
<div class="box tabular">
<% unless @role.builtin? %>
<p><%= f.text_field :name, :required => true %></p>
@@ -12,7 +11,6 @@
<%= select_tag(:copy_workflow_from, content_tag("option") + options_from_collection_for_select(@roles, :id, :name, params[:copy_workflow_from] || @copy_from.try(:id))) %></p>
<% end %>
</div>
<% end %>
<h3><%= l(:label_permissions) %></h3>
<div class="box tabular" id="permissions">

View File

@@ -80,8 +80,9 @@ bs:
format:
unit: 'KM'
format: '%u %n'
negative_format: '%u -%n'
delimiter: ''
separator:
delimiter:
precision:
percentage:
format:
delimiter: ""

View File

@@ -84,7 +84,9 @@ de:
format:
unit: '€'
format: '%n %u'
delimiter: ''
separator:
delimiter:
precision:
percentage:
format:
delimiter: ""
@@ -844,7 +846,7 @@ de:
button_show: Anzeigen
status_active: aktiv
status_registered: nicht aktivierte
status_registered: angemeldet
status_locked: gesperrt
version_status_open: offen
@@ -1017,8 +1019,8 @@ de:
description_date_from: Startdatum eintragen
description_date_to: Enddatum eintragen
label_parent_revision: Vorgänger
label_child_revision: Nachfolger
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: Der Eintrag kann nicht umgesetzt werden, da er die maximale Textlänge überschreitet.
setting_default_issue_start_date_to_creation_date: Aktuelles Datum als Beginn für neue Tickets verwenden
button_edit_section: Diesen Bereich bearbeiten
@@ -1068,14 +1070,14 @@ de:
field_timeout: Auszeit (in Sekunden)
setting_thumbnails_enabled: Vorschaubilder von Dateianhängen anzeigen
setting_thumbnails_size: Größe der Vorschaubilder (in Pixel)
label_status_transitions: Statusänderungen
label_fields_permissions: Feldberechtigungen
label_status_transitions: Status transitions
label_fields_permissions: Fields permissions
label_readonly: Nur-Lese-Zugriff
label_required: Erforderlich
text_repository_identifier_info: 'Kleinbuchstaben (a-z), Ziffern, Binde- und Unterstriche erlaubt.<br />Einmal gespeichert, kann die Kennung nicht mehr geändert werden.'
field_board_parent: Übergeordnetes Forum
label_attribute_of_project: "%{name} des Projekts"
label_attribute_of_author: "%{name} des Autors"
label_attribute_of_assigned_to: "%{name} des Bearbeiters"
label_attribute_of_fixed_version: "%{name} der Zielversion"
label_copy_subtasks: Unteraufgaben kopieren
field_board_parent: Parent forum
label_attribute_of_project: Project's %{name}
label_attribute_of_author: Author's %{name}
label_attribute_of_assigned_to: Assignee's %{name}
label_attribute_of_fixed_version: Target version's %{name}
label_copy_subtasks: Copy subtasks

View File

@@ -1152,27 +1152,27 @@ ru:
setting_session_lifetime: Session maximum lifetime
setting_session_timeout: Session inactivity timeout
label_session_expiration: Session expiration
permission_close_project: Закрывать / открывать проекты
label_show_closed_projects: Просматривать закрытые проекты
button_close: Сделать закрытым
button_reopen: Сделать открытым
project_status_active: открытые
project_status_closed: закрытые
project_status_archived: архивированные
text_project_closed: Проект закрыт и находиться в режиме только для чтения.
notice_user_successful_create: Пользователь %{id} создан.
field_core_fields: Стандартные поля
permission_close_project: Close / reopen the project
label_show_closed_projects: View closed projects
button_close: Close
button_reopen: Reopen
project_status_active: active
project_status_closed: closed
project_status_archived: archived
text_project_closed: This project is closed and read-only.
notice_user_successful_create: User %{id} created.
field_core_fields: Standard fields
field_timeout: Timeout (in seconds)
setting_thumbnails_enabled: Display attachment thumbnails
setting_thumbnails_size: Thumbnails size (in pixels)
label_status_transitions: Статус-переходы
label_fields_permissions: Права на изменения полей
label_readonly: Не изменяется
label_required: Обязательное
label_status_transitions: Status transitions
label_fields_permissions: Fields permissions
label_readonly: Read-only
label_required: Required
text_repository_identifier_info: Допускаются только строчные латинские буквы (a-z), цифры, тире и подчеркивания.<br />После сохранения идентификатор изменить нельзя.
field_board_parent: Родительский форум
field_board_parent: Parent forum
label_attribute_of_project: Project's %{name}
label_attribute_of_author: Имя автора %{name}
label_attribute_of_author: Author's %{name}
label_attribute_of_assigned_to: Assignee's %{name}
label_attribute_of_fixed_version: Target version's %{name}
label_copy_subtasks: Копировать подзадачи
label_copy_subtasks: Copy subtasks

View File

@@ -939,7 +939,6 @@
label_child_revision: 子項
label_export_options: "%{export_format} 匯出選項"
label_copy_attachments: 複製附件
label_copy_subtasks: 複製子任務
label_item_position: "%{position} / %{count}"
label_completed_versions: 已完成版本
label_search_for_watchers: 搜尋可供加入的監看者
@@ -1144,3 +1143,4 @@
description_date_from: 輸入起始日期
description_date_to: 輸入結束日期
text_repository_identifier_info: '僅允許使用小寫英文字母 (a-z), 阿拉伯數字, 虛線與底線。<br />一旦儲存之後, 代碼便無法再次被更改。'
label_copy_subtasks: Copy subtasks

View File

@@ -1061,9 +1061,9 @@ zh:
label_readonly: 只读
label_required: 必填
text_repository_identifier_info: 仅小写字母a-z、数字、破折号-和下划线_可以使用。<br />一旦保存,标识无法修改。
field_board_parent: 父论坛
label_attribute_of_project: 项目 %{name}
label_attribute_of_author: 作者 %{name}
label_attribute_of_assigned_to: 分配给 %{name}
label_attribute_of_fixed_version: 目标版本 %{name}
label_copy_subtasks: 复制子任务
field_board_parent: Parent forum
label_attribute_of_project: Project's %{name}
label_attribute_of_author: Author's %{name}
label_attribute_of_assigned_to: Assignee's %{name}
label_attribute_of_fixed_version: Target version's %{name}
label_copy_subtasks: Copy subtasks

View File

@@ -4,45 +4,6 @@ Redmine - project management software
Copyright (C) 2006-2012 Jean-Philippe Lang
http://www.redmine.org/
== 2012-11-17 v2.1.3
* Defect #12050: :export links to repository files lead to a 404 error
* Defect #12189: Missing tmp/pdf directory
* Defect #12195: Javascript error with IE7 / IE8 on new issue form
* Defect #12196: "Page not found" on OK button in SCM "View all revisions" page
* Defect #12199: Confirmation message displayed when clicking a disabled delete link in the context menu
* Defect #12231: Hardcoded "Back" in Repository
* Defect #12294: Incorrect german translation for "registered" users filter
* Defect #12349: Watchers auto-complete search on non-latin chars
* Defect #12358: 'None' grouped issue list section should be translated
* Defect #12359: Version date field regex validation accepts invalid date
* Defect #12375: Receiving mail subject encoding broken (MOJIBAKE) in some cases on Ruby 1.8
* Patch #9732: German translations
* Patch #12021: Russian locale translations
* Patch #12188: Simplified Chinese translation with zh.yml file based on Rev:10681
* Patch #12235: German translation for 2.1-stable
* Patch #12237: Added German Translation
== 2012-09-30 v2.1.2
* Defect #11929: XSS vulnerability in Redmine 2.1.x
== 2012-09-30 v2.1.1
* Defect #11290: ParseDate missing in Ruby 1.9x
* Defect #11844: "load_default_data" rake task fails to print the error message if one occurs
* Defect #11850: Can't create a user from ldap by on-the-fly on the redmine server using URI prefix
* Defect #11872: Private issue visible to anonymous users after its author is deleted
* Defect #11885: Filter misses Selectionfield on IE8
* Defect #11893: New relation form Cancel link is broken with Chrome 21
* Defect #11905: Potential "can't dup NilClass" error in UserPreference
* Defect #11909: Autocomplete results not reset after clearing search field
* Defect #11922: bs.yml and de.yml lead to error by number_to_currency()
* Defect #11945: rake task prints "can't convert Errno::EACCES into String" in case of no permission of public/plugin_assets
* Defect #11975: Undefined status transitions allowed in workflow (author of issue changes when selecting a new status)
* Defect #11982: SCM diff view generates extra parameter for switching mode
* Patch #11897: Traditional Chinese language file (to r10433)
== 2012-09-16 v2.1.0
* Defect #2071: Reordering priority-enumerations breaks alternate-theme's issue-colouring

View File

@@ -1,4 +1,5 @@
require 'SVG/Graph/Plot'
require 'parsedate'
module SVG
module Graph
@@ -156,7 +157,8 @@ module SVG
y = []
data[:data].each_index {|i|
if i%2 == 0
t = DateTime.parse( data[:data][i] ).to_time
arr = ParseDate.parsedate( data[:data][i] )
t = Time.local( *arr[0,6].compact )
x << t.to_i
else
y << data[:data][i]
@@ -171,7 +173,8 @@ module SVG
protected
def min_x_value=(value)
@min_x_value = DateTime.parse( data[:data][i] ).to_time
arr = ParseDate.parsedate( value )
@min_x_value = Time.local( *arr[0,6].compact ).to_i
end

View File

@@ -30,7 +30,7 @@ module Redmine
attachable_options[:delete_permission] = options.delete(:delete_permission) || "edit_#{self.name.pluralize.underscore}".to_sym
has_many :attachments, options.merge(:as => :container,
:order => "#{Attachment.table_name}.created_on ASC, #{Attachment.table_name}.id ASC",
:order => "#{Attachment.table_name}.created_on",
:dependent => :destroy)
send :include, Redmine::Acts::Attachable::InstanceMethods
before_save :attach_saved_attachments
@@ -62,19 +62,7 @@ module Redmine
def save_attachments(attachments, author=User.current)
if attachments.is_a?(Hash)
attachments = attachments.stringify_keys
attachments = attachments.to_a.sort {|a, b|
if a.first.to_i > 0 && b.first.to_i > 0
a.first.to_i <=> b.first.to_i
elsif a.first.to_i > 0
1
elsif b.first.to_i > 0
-1
else
a.first <=> b.first
end
}
attachments = attachments.map(&:last)
attachments = attachments.values
end
if attachments.is_a?(Array)
attachments.each do |attachment|

View File

@@ -336,11 +336,7 @@ module Redmine #:nodoc:
unless source_files.empty?
base_target_dir = File.join(destination, File.dirname(source_files.first).gsub(source, ''))
begin
FileUtils.mkdir_p(base_target_dir)
rescue Exception => e
raise "Could not create directory #{base_target_dir}: " + e.message
end
FileUtils.mkdir_p(base_target_dir)
end
source_dirs.each do |dir|
@@ -350,7 +346,7 @@ module Redmine #:nodoc:
begin
FileUtils.mkdir_p(target_dir)
rescue Exception => e
raise "Could not create directory #{target_dir}: " + e.message
raise "Could not create directory #{target_dir}: \n" + e
end
end
@@ -361,7 +357,7 @@ module Redmine #:nodoc:
FileUtils.cp(file, target)
end
rescue Exception => e
raise "Could not copy #{file} to #{target}: " + e.message
raise "Could not copy #{file} to #{target}: \n" + e
end
end
end

View File

@@ -4,7 +4,7 @@ module Redmine
module VERSION #:nodoc:
MAJOR = 2
MINOR = 1
TINY = 3
TINY = 0
# Branch values:
# * official release: nil

View File

@@ -26,9 +26,9 @@ namespace :redmine do
Redmine::DefaultData::Loader.load(current_language)
puts "Default configuration data loaded."
rescue Redmine::DefaultData::DataAlreadyLoaded => error
puts error.message
puts error
rescue => error
puts "Error: " + error.message
puts "Error: " + error
puts "Default configuration data was not loaded."
end
end

View File

@@ -152,10 +152,10 @@ function buildFilterRow(field, operator, values) {
var option = $('<option>');
if ($.isArray(filterValue)) {
option.val(filterValue[1]).text(filterValue[0]);
if ($.inArray(filterValue[1], values) > -1) {option.attr('selected', true);}
if (values.indexOf(filterValue[1]) > -1) {option.attr('selected', true)};
} else {
option.val(filterValue).text(filterValue);
if ($.inArray(filterValue, values) > -1) {option.attr('selected', true);}
if (values.indexOf(filterValue) > -1) {option.attr('selected', true)};
}
select.append(option);
}
@@ -163,9 +163,9 @@ function buildFilterRow(field, operator, values) {
case "date":
case "date_past":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="3" class="value" /> '+labelDayPlural+'</span>'
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="10" class="value date_value" value="'+values[0]+'" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="10" class="value date_value" value="'+values[1]+'" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="3" class="value" value="'+values[0]+'" /> '+labelDayPlural+'</span>'
);
$('#values_'+fieldId+'_1').val(values[0]).datepicker(datepickerOptions);
$('#values_'+fieldId+'_2').val(values[1]).datepicker(datepickerOptions);
@@ -174,15 +174,15 @@ function buildFilterRow(field, operator, values) {
case "string":
case "text":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="30" class="value" /></span>'
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'" size="30" class="value" value="'+values[0]+'" /></span>'
);
$('#values_'+fieldId).val(values[0]);
break;
case "integer":
case "float":
tr.find('td.values').append(
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="6" class="value" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="6" class="value" /></span>'
'<span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_1" size="6" class="value" value="'+values[0]+'" /></span>' +
' <span style="display:none;"><input type="text" name="v['+field+'][]" id="values_'+fieldId+'_2" size="6" class="value" value="'+values[1]+'" /></span>'
);
$('#values_'+fieldId+'_1').val(values[0]);
$('#values_'+fieldId+'_2').val(values[1]);
@@ -204,7 +204,7 @@ function toggleFilter(field) {
function enableValues(field, indexes) {
var fieldId = field.replace('.', '_');
$('#tr_'+fieldId+' td.values .value').each(function(index) {
if ($.inArray(index, indexes) >= 0) {
if (indexes.indexOf(index) >= 0) {
$(this).removeAttr('disabled');
$(this).parents('span').first().show();
} else {
@@ -464,11 +464,9 @@ function updateBulkEditFrom(url) {
}
function observeAutocompleteField(fieldId, url) {
$(document).ready(function() {
$('#'+fieldId).autocomplete({
source: url,
minLength: 2
});
$('#'+fieldId).autocomplete({
source: url,
minLength: 2,
});
}
@@ -480,14 +478,16 @@ function observeSearchfield(fieldId, targetId, url) {
var val = $this.val();
if ($this.attr('data-value-was') != val){
$this.attr('data-value-was', val);
$.ajax({
url: url,
type: 'get',
data: {q: $this.val()},
success: function(data){ $('#'+targetId).html(data); },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
});
if (val != '') {
$.ajax({
url: url,
type: 'get',
data: {q: $this.val()},
success: function(data){ $('#'+targetId).html(data); },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
});
}
}
};
var reset = function() {

View File

@@ -1,7 +0,0 @@
From: John Smith <JSmith@somenet.foo>
To: "redmine@somenet.foo" <redmine@somenet.foo>
Subject: =?iso-2022-jp?b?GyRCJUYlOSVIGyhCCg=?=
Date: Fri, 1 Jun 2012 14:39:38 +0200
Message-ID: <87C31D42249DD0489D1A1444E3232DD7019D6183@foo.bar>
Fixture

View File

@@ -1,7 +0,0 @@
From: John Smith <JSmith@somenet.foo>
To: "redmine@somenet.foo" <redmine@somenet.foo>
Subject: Re: =?iso-2022-jp?b?GyRCJUYlOSVIGyhCCg=?=
Date: Fri, 1 Jun 2012 14:39:38 +0200
Message-ID: <87C31D42249DD0489D1A1444E3232DD7019D6183@foo.bar>
Fixture

View File

@@ -96,13 +96,8 @@ class AttachmentsControllerTest < ActionController::TestCase
end
def test_save_diff_type
user1 = User.find(1)
user1.pref[:diff_type] = nil
user1.preference.save
user = User.find(1)
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
user = User.find(1)
get :show, :id => 5
assert_response :success
assert_template 'diff'

View File

@@ -2521,18 +2521,6 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal 'This is the test_new issue', issue.subject
end
def test_update_edit_form_should_keep_issue_author
@request.session[:user_id] = 3
xhr :put, :new, :project_id => 1, :id => 1, :issue => {:subject => 'Changed'}
assert_response :success
assert_equal 'text/javascript', response.content_type
issue = assigns(:issue)
assert_equal User.find(2), issue.author
assert_equal 2, issue.author_id
assert_not_equal User.current, issue.author
end
def test_update_edit_form_should_propose_transitions_based_on_initial_status
@request.session[:user_id] = 2
WorkflowTransition.delete_all

View File

@@ -273,12 +273,4 @@ class QueriesControllerTest < ActionController::TestCase
assert_redirected_to :controller => 'issues', :action => 'index', :project_id => 'ecookbook', :set_filter => 1, :query_id => nil
assert_nil Query.find_by_id(1)
end
def test_backslash_should_be_escaped_in_filters
@request.session[:user_id] = 2
get :new, :subject => 'foo/bar'
assert_response :success
assert_template 'new'
assert_include 'addFilter("subject", "=", ["foo\/bar"]);', response.body
end
end

View File

@@ -53,6 +53,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
if @char_1.respond_to?(:force_encoding)
@char_1.force_encoding('UTF-8')
end
Setting.default_language = 'en'
end
def test_create_and_update
@@ -261,8 +263,6 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end
def test_diff
assert_equal true, @repository.is_default
assert_nil @repository.identifier
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@project.reload
@@ -320,12 +320,10 @@ class RepositoriesGitControllerTest < ActionController::TestCase
with_settings :diff_max_lines_displayed => 5 do
# Truncated diff of changeset 2f9c0091
with_cache do
with_settings :default_language => 'en' do
get :diff, :id => PRJ_ID, :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
assert_response :success
assert @response.body.include?("... This diff was truncated")
end
get :diff, :id => PRJ_ID, :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
assert_response :success
assert @response.body.include?("... This diff was truncated")
with_settings :default_language => 'fr' do
get :diff, :id => PRJ_ID, :type => 'inline',
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
@@ -353,55 +351,9 @@ class RepositoriesGitControllerTest < ActionController::TestCase
diff = assigns(:diff)
assert_not_nil diff
assert_tag :tag => 'h2', :content => /2f9c0091:61b685fb/
assert_tag :tag => "form",
:attributes => {
:action => "/projects/subproject1/repository/revisions/" +
"61b685fbe55ab05b5ac68402d5720c1a6ac973d1/diff"
}
assert_tag :tag => 'input',
:attributes => {
:id => "rev_to",
:name => "rev_to",
:type => "hidden",
:value => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
}
end
end
def test_diff_path_in_subrepo
repo = Repository::Git.create(
:project => @project,
:url => REPOSITORY_PATH,
:identifier => 'test-diff-path',
:path_encoding => 'ISO-8859-1'
);
assert repo
assert_equal false, repo.is_default
assert_equal 'test-diff-path', repo.identifier
get :diff,
:id => PRJ_ID,
:repository_id => 'test-diff-path',
:rev => '61b685fbe55ab05b',
:rev_to => '2f9c0091c754a91a',
:type => 'inline'
assert_response :success
assert_template 'diff'
diff = assigns(:diff)
assert_not_nil diff
assert_tag :tag => "form",
:attributes => {
:action => "/projects/subproject1/repository/test-diff-path/" +
"revisions/61b685fbe55ab05b/diff"
}
assert_tag :tag => 'input',
:attributes => {
:id => "rev_to",
:name => "rev_to",
:type => "hidden",
:value => '2f9c0091c754a91a'
}
end
def test_diff_latin_1
if @ruby19_non_utf8_pass
puts_ruby19_non_utf8_pass()
@@ -433,13 +385,8 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end
def test_save_diff_type
user1 = User.find(1)
user1.pref[:diff_type] = nil
user1.preference.save
user = User.find(1)
assert_nil user.pref[:diff_type]
@request.session[:user_id] = 1 # admin
user = User.find(1)
get :diff,
:id => PRJ_ID,
:rev => '2f9c0091c754a91af7a9c478e36556b4bde8dcf7'
@@ -532,21 +479,6 @@ class RepositoriesGitControllerTest < ActionController::TestCase
end
end
def test_revisions
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets
@project.reload
assert_equal NUM_REV, @repository.changesets.count
get :revisions, :id => PRJ_ID
assert_response :success
assert_template 'revisions'
assert_tag :tag => 'form',
:attributes => {
:method => 'get',
:action => '/projects/subproject1/repository/revision'
}
end
def test_revision
assert_equal 0, @repository.changesets.count
@repository.fetch_changesets

View File

@@ -110,14 +110,6 @@ class RolesControllerTest < ActionController::TestCase
assert_response :success
assert_template 'edit'
assert_equal Role.find(1), assigns(:role)
assert_select 'select[name=?]', 'role[issues_visibility]'
end
def test_edit_anonymous
get :edit, :id => Role.anonymous.id
assert_response :success
assert_template 'edit'
assert_select 'select[name=?]', 'role[issues_visibility]', 0
end
def test_edit_invalid_should_respond_with_404

View File

@@ -25,7 +25,6 @@ class ApiTest::IssuesTest < ActionController::IntegrationTest
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:versions,
:trackers,
:projects_trackers,

View File

@@ -61,8 +61,6 @@ module ObjectHelpers
def Issue.generate!(attributes={})
issue = Issue.new(attributes)
issue.project ||= Project.find(1)
issue.tracker ||= issue.project.trackers.first
issue.subject = 'Generated' if issue.subject.blank?
issue.author ||= User.find(2)
yield issue if block_given?

View File

@@ -22,8 +22,6 @@ require File.expand_path('../../test_helper', __FILE__)
class BoardTest < ActiveSupport::TestCase
fixtures :projects, :boards, :messages, :attachments, :watchers
include Redmine::I18n
def setup
@project = Project.find(1)
end
@@ -43,7 +41,6 @@ class BoardTest < ActiveSupport::TestCase
end
def test_parent_should_be_in_same_project
set_language_if_valid 'en'
board = Board.new(:project_id => 3, :name => 'Test', :description => 'Test', :parent_id => 1)
assert !board.save
assert_include "Parent forum is invalid", board.errors.full_messages

View File

@@ -179,8 +179,7 @@ class ChangesetTest < ActiveSupport::TestCase
end
def test_commit_closing_a_subproject_issue
with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes',
:default_language => 'en' do
with_settings :commit_fix_status_id => 5, :commit_fix_keywords => 'closes' do
issue = Issue.find(5)
assert !issue.closed?
assert_difference 'Journal.count' do

View File

@@ -253,15 +253,8 @@ RAW
project_url = {:controller => 'projects', :action => 'show', :id => 'subproject1'}
source_url = '/projects/ecookbook/repository/entry/some/file'
source_url_with_rev = '/projects/ecookbook/repository/revisions/52/entry/some/file'
source_url_with_ext = '/projects/ecookbook/repository/entry/some/file.ext'
source_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/entry/some/file.ext'
export_url = '/projects/ecookbook/repository/raw/some/file'
export_url_with_rev = '/projects/ecookbook/repository/revisions/52/raw/some/file'
export_url_with_ext = '/projects/ecookbook/repository/raw/some/file.ext'
export_url_with_rev_and_ext = '/projects/ecookbook/repository/revisions/52/raw/some/file.ext'
source_url = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file']}
source_url_with_ext = {:controller => 'repositories', :action => 'entry', :id => 'ecookbook', :path => ['some', 'file.ext']}
to_test = {
# tickets
@@ -291,16 +284,12 @@ RAW
'source:/some/file. ' => link_to('source:/some/file', source_url, :class => 'source') + ".",
'source:/some/file.ext. ' => link_to('source:/some/file.ext', source_url_with_ext, :class => 'source') + ".",
'source:/some/file, ' => link_to('source:/some/file', source_url, :class => 'source') + ",",
'source:/some/file@52' => link_to('source:/some/file@52', source_url_with_rev, :class => 'source'),
'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_rev_and_ext, :class => 'source'),
'source:/some/file#L110' => link_to('source:/some/file#L110', source_url + "#L110", :class => 'source'),
'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext + "#L110", :class => 'source'),
'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url_with_rev + "#L110", :class => 'source'),
# export
'export:/some/file' => link_to('export:/some/file', export_url, :class => 'source download'),
'export:/some/file.ext' => link_to('export:/some/file.ext', export_url_with_ext, :class => 'source download'),
'export:/some/file@52' => link_to('export:/some/file@52', export_url_with_rev, :class => 'source download'),
'export:/some/file.ext@52' => link_to('export:/some/file.ext@52', export_url_with_rev_and_ext, :class => 'source download'),
'source:/some/file@52' => link_to('source:/some/file@52', source_url.merge(:rev => 52), :class => 'source'),
'source:/some/file.ext@52' => link_to('source:/some/file.ext@52', source_url_with_ext.merge(:rev => 52), :class => 'source'),
'source:/some/file#L110' => link_to('source:/some/file#L110', source_url.merge(:anchor => 'L110'), :class => 'source'),
'source:/some/file.ext#L110' => link_to('source:/some/file.ext#L110', source_url_with_ext.merge(:anchor => 'L110'), :class => 'source'),
'source:/some/file@52#L110' => link_to('source:/some/file@52#L110', source_url.merge(:rev => 52, :anchor => 'L110'), :class => 'source'),
'export:/some/file' => link_to('export:/some/file', source_url.merge(:format => 'raw'), :class => 'source download'),
# forum
'forum#2' => link_to('Discussion', board_url, :class => 'board'),
'forum:Discussion' => link_to('Discussion', board_url, :class => 'board'),

View File

@@ -109,55 +109,51 @@ class IssuesHelperTest < ActionView::TestCase
end
end
context "with a start_date attribute" do
should "format the current date" do
@detail = JournalDetail.new(
def test_with_a_start_date_attribute_should_format_the_current_date
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'start_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
end
should "format the old date" do
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'start_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
end
context "with a due_date attribute" do
should "format the current date" do
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'due_date'
def test_with_a_start_date_attribute_should_format_the_old_date
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'start_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
end
should "format the old date" do
@detail = JournalDetail.new(
def test_with_a_due_date_attribute_should_with_a_due_date_attribute
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'due_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/31/2010", show_detail(@detail, true)
end
end
def test_with_a_due_date_attribute_should_format_the_old_date
@detail = JournalDetail.new(
:property => 'attr',
:old_value => '2010-01-01',
:value => '2010-01-31',
:prop_key => 'due_date'
)
with_settings :date_format => '%m/%d/%Y' do
assert_match "01/01/2010", show_detail(@detail, true)
end
end

View File

@@ -18,17 +18,7 @@
require File.expand_path('../../test_helper', __FILE__)
class IssueRelationTest < ActiveSupport::TestCase
fixtures :projects,
:users,
:roles,
:members,
:member_roles,
:issues,
:issue_statuses,
:issue_relations,
:enabled_modules,
:enumerations,
:trackers
fixtures :issue_relations, :issues
def test_create
from = Issue.find(1)

View File

@@ -25,7 +25,7 @@ class IssueTest < ActiveSupport::TestCase
:versions,
:issue_statuses, :issue_categories, :issue_relations, :workflows,
:enumerations,
:issues, :journals, :journal_details,
:issues,
:custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values,
:time_entries
@@ -105,6 +105,18 @@ class IssueTest < ActiveSupport::TestCase
assert_visibility_match User.anonymous, issues
end
def test_visible_scope_for_anonymous_with_own_issues_visibility
Role.anonymous.update_attribute :issues_visibility, 'own'
Issue.create!(:project_id => 1, :tracker_id => 1,
:author_id => User.anonymous.id,
:subject => 'Issue by anonymous')
issues = Issue.visible(User.anonymous).all
assert issues.any?
assert_nil issues.detect {|issue| issue.author != User.anonymous}
assert_visibility_match User.anonymous, issues
end
def test_visible_scope_for_anonymous_without_view_issues_permissions
# Anonymous user should not see issues without permission
Role.anonymous.remove_permission!(:view_issues)
@@ -113,20 +125,6 @@ class IssueTest < ActiveSupport::TestCase
assert_visibility_match User.anonymous, issues
end
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default
assert Role.anonymous.update_attribute(:issues_visibility, 'default')
issue = Issue.generate_for_project!(Project.find(1), :author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
assert !issue.visible?(User.anonymous)
end
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own
assert Role.anonymous.update_attribute(:issues_visibility, 'own')
issue = Issue.generate_for_project!(Project.find(1), :author => User.anonymous, :assigned_to => User.anonymous, :is_private => true)
assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
assert !issue.visible?(User.anonymous)
end
def test_visible_scope_for_non_member
user = User.find(9)
assert user.projects.empty?
@@ -1576,18 +1574,4 @@ class IssueTest < ActiveSupport::TestCase
def test_journals_after_with_blank_arg_should_return_all_journals
assert_equal [Journal.find(1), Journal.find(2)], Issue.find(1).journals_after('')
end
def test_save_attachments_with_hash_should_save_attachments_in_keys_order
set_tmp_attachments_directory
issue = Issue.generate!
issue.save_attachments({
'p0' => {'file' => mock_file_with_options(:original_filename => 'upload')},
'3' => {'file' => mock_file_with_options(:original_filename => 'bar')},
'1' => {'file' => mock_file_with_options(:original_filename => 'foo')}
})
issue.attach_saved_attachments
assert_equal 3, issue.reload.attachments.count
assert_equal %w(upload foo bar), issue.attachments.map(&:filename)
end
end

View File

@@ -171,24 +171,6 @@ class Redmine::I18nTest < ActiveSupport::TestCase
assert_equal 'j', day_letter(4)
end
def test_number_to_currency_for_each_language
valid_languages.each do |lang|
set_language_if_valid lang
assert_nothing_raised "#{lang} failure" do
number_to_currency(-1000.2)
end
end
end
def test_number_to_currency_default
set_language_if_valid 'bs'
assert_equal "KM -1000,20", number_to_currency(-1000.2)
set_language_if_valid 'de'
euro_sign = "\xe2\x82\xac"
euro_sign.force_encoding('UTF-8') if euro_sign.respond_to?(:force_encoding)
assert_equal "-1000,20 #{euro_sign}", number_to_currency(-1000.2)
end
def test_valid_languages
assert valid_languages.is_a?(Array)
assert valid_languages.first.is_a?(Symbol)

View File

@@ -382,28 +382,6 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_equal 'Testmail from Webmail: ä ö ü...', issue.subject
end
def test_add_issue_with_japanese_subject
issue = submit_email(
'subject_japanese_1.eml',
:issue => {:project => 'ecookbook'}
)
assert_kind_of Issue, issue
ja = "\xe3\x83\x86\xe3\x82\xb9\xe3\x83\x88"
ja.force_encoding('UTF-8') if ja.respond_to?(:force_encoding)
assert_equal ja, issue.subject
end
def test_add_issue_with_mixed_japanese_subject
issue = submit_email(
'subject_japanese_2.eml',
:issue => {:project => 'ecookbook'}
)
assert_kind_of Issue, issue
ja = "Re: \xe3\x83\x86\xe3\x82\xb9\xe3\x83\x88"
ja.force_encoding('UTF-8') if ja.respond_to?(:force_encoding)
assert_equal ja, issue.subject
end
def test_should_ignore_emails_from_locked_users
User.find(2).lock!

View File

@@ -1,5 +1,3 @@
# encoding: utf-8
#
# Redmine - project management software
# Copyright (C) 2006-2012 Jean-Philippe Lang
#
@@ -108,11 +106,4 @@ class PrincipalTest < ActiveSupport::TestCase
assert_equal @palmer, results.first
end
end
def test_like_scope_with_cyrillic_name
user = User.generate!(:firstname => 'Соболев', :lastname => 'Денис')
results = Principal.like('Собо')
assert_equal 1, results.count
assert_equal user, results.first
end
end

View File

@@ -54,19 +54,4 @@ class UserPreferenceTest < ActiveSupport::TestCase
assert up.save
assert_kind_of Hash, up.others
end
def test_reading_value_from_nil_others_hash
up = UserPreference.new(:user => User.new)
up.others = nil
assert_nil up.others
assert_nil up[:foo]
end
def test_writing_value_to_nil_others_hash
up = UserPreference.new(:user => User.new)
up.others = nil
assert_nil up.others
up[:foo] = 'bar'
assert_equal 'bar', up[:foo]
end
end

View File

@@ -32,13 +32,7 @@ class VersionTest < ActiveSupport::TestCase
def test_invalid_effective_date_validation
v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '99999-01-01')
assert !v.valid?
v.effective_date = '2012-11-33'
assert !v.valid?
v.effective_date = '2012-31-11'
assert !v.valid?
v.effective_date = 'ABC'
assert !v.valid?
assert !v.save
assert_include I18n.translate('activerecord.errors.messages.not_a_date'),
v.errors[:effective_date]
end

View File