Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b83ed5a040 | ||
|
|
c4736ed42b | ||
|
|
47fb2eb998 | ||
|
|
e9813791cb | ||
|
|
5f23ebc31c | ||
|
|
b88c95b0fb | ||
|
|
93d8f99884 | ||
|
|
07edb10518 |
@@ -1,6 +1,6 @@
|
|||||||
source 'http://rubygems.org'
|
source 'http://rubygems.org'
|
||||||
|
|
||||||
gem 'rails', '3.2.3'
|
gem 'rails', '3.2.5'
|
||||||
gem 'prototype-rails', '3.2.1'
|
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"
|
||||||
|
|||||||
@@ -18,12 +18,13 @@
|
|||||||
class TimelogController < ApplicationController
|
class TimelogController < ApplicationController
|
||||||
menu_item :issues
|
menu_item :issues
|
||||||
|
|
||||||
before_filter :find_project, :only => [:create]
|
before_filter :find_project_for_new_time_entry, :only => [:create]
|
||||||
before_filter :find_time_entry, :only => [:show, :edit, :update]
|
before_filter :find_time_entry, :only => [:show, :edit, :update]
|
||||||
before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
|
before_filter :find_time_entries, :only => [:bulk_edit, :bulk_update, :destroy]
|
||||||
before_filter :authorize, :except => [:new, :index, :report]
|
before_filter :authorize, :except => [:new, :index, :report]
|
||||||
|
|
||||||
before_filter :find_optional_project, :only => [:new, :index, :report]
|
before_filter :find_optional_project, :only => [:index, :report]
|
||||||
|
before_filter :find_optional_project_for_new_time_entry, :only => [:new]
|
||||||
before_filter :authorize_global, :only => [:new, :index, :report]
|
before_filter :authorize_global, :only => [:new, :index, :report]
|
||||||
|
|
||||||
accept_rss_auth :index
|
accept_rss_auth :index
|
||||||
@@ -133,9 +134,13 @@ class TimelogController < ApplicationController
|
|||||||
flash[:notice] = l(:notice_successful_create)
|
flash[:notice] = l(:notice_successful_create)
|
||||||
if params[:continue]
|
if params[:continue]
|
||||||
if params[:project_id]
|
if params[:project_id]
|
||||||
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue, :back_url => params[:back_url]
|
redirect_to :action => 'new', :project_id => @time_entry.project, :issue_id => @time_entry.issue,
|
||||||
|
:time_entry => {:issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
|
||||||
|
:back_url => params[:back_url]
|
||||||
else
|
else
|
||||||
redirect_to :action => 'new', :back_url => params[:back_url]
|
redirect_to :action => 'new',
|
||||||
|
:time_entry => {:project_id => @time_entry.project_id, :issue_id => @time_entry.issue_id, :activity_id => @time_entry.activity_id},
|
||||||
|
:back_url => params[:back_url]
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
redirect_back_or_default :action => 'index', :project_id => @time_entry.project
|
||||||
@@ -258,7 +263,7 @@ private
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_project
|
def find_optional_project_for_new_time_entry
|
||||||
if (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
|
if (project_id = (params[:project_id] || params[:time_entry] && params[:time_entry][:project_id])).present?
|
||||||
@project = Project.find(project_id)
|
@project = Project.find(project_id)
|
||||||
end
|
end
|
||||||
@@ -266,14 +271,17 @@ private
|
|||||||
@issue = Issue.find(issue_id)
|
@issue = Issue.find(issue_id)
|
||||||
@project ||= @issue.project
|
@project ||= @issue.project
|
||||||
end
|
end
|
||||||
if @project.nil?
|
|
||||||
render_404
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def find_project_for_new_time_entry
|
||||||
|
find_optional_project_for_new_time_entry
|
||||||
|
if @project.nil?
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def find_optional_project
|
def find_optional_project
|
||||||
if !params[:issue_id].blank?
|
if !params[:issue_id].blank?
|
||||||
@issue = Issue.find(params[:issue_id])
|
@issue = Issue.find(params[:issue_id])
|
||||||
|
|||||||
@@ -46,17 +46,17 @@ module RepositoriesHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def render_changeset_changes
|
def render_changeset_changes
|
||||||
changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change|
|
changes = @changeset.filechanges.find(:all, :limit => 1000, :order => 'path').collect do |change|
|
||||||
case change.action
|
case change.action
|
||||||
when 'A'
|
when 'A'
|
||||||
# Detects moved/copied files
|
# Detects moved/copied files
|
||||||
if !change.from_path.blank?
|
if !change.from_path.blank?
|
||||||
change.action =
|
change.action =
|
||||||
@changeset.changes.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
|
@changeset.filechanges.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C'
|
||||||
end
|
end
|
||||||
change
|
change
|
||||||
when 'D'
|
when 'D'
|
||||||
@changeset.changes.detect {|c| c.from_path == change.path} ? nil : change
|
@changeset.filechanges.detect {|c| c.from_path == change.path} ? nil : change
|
||||||
else
|
else
|
||||||
change
|
change
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ require 'iconv'
|
|||||||
class Changeset < ActiveRecord::Base
|
class Changeset < ActiveRecord::Base
|
||||||
belongs_to :repository
|
belongs_to :repository
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
has_many :changes, :dependent => :delete_all
|
has_many :filechanges, :class_name => 'Change', :dependent => :delete_all
|
||||||
has_and_belongs_to_many :issues
|
has_and_belongs_to_many :issues
|
||||||
has_and_belongs_to_many :parents,
|
has_and_belongs_to_many :parents,
|
||||||
:class_name => "Changeset",
|
:class_name => "Changeset",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Repository < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :project
|
belongs_to :project
|
||||||
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
|
has_many :changesets, :order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC"
|
||||||
has_many :changes, :through => :changesets
|
has_many :filechanges, :class_name => 'Change', :through => :changesets
|
||||||
|
|
||||||
serialize :extra_info
|
serialize :extra_info
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ class Repository < ActiveRecord::Base
|
|||||||
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
|
:order => "#{Changeset.table_name}.committed_on DESC, #{Changeset.table_name}.id DESC",
|
||||||
:limit => limit)
|
:limit => limit)
|
||||||
else
|
else
|
||||||
changes.find(
|
filechanges.find(
|
||||||
:all,
|
:all,
|
||||||
:include => {:changeset => :user},
|
:include => {:changeset => :user},
|
||||||
:conditions => ["path = ?", path.with_leading_slash],
|
:conditions => ["path = ?", path.with_leading_slash],
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class Repository::Cvs < Repository
|
|||||||
if entries
|
if entries
|
||||||
entries.each() do |entry|
|
entries.each() do |entry|
|
||||||
if ( ! entry.lastrev.nil? ) && ( ! entry.lastrev.revision.nil? )
|
if ( ! entry.lastrev.nil? ) && ( ! entry.lastrev.revision.nil? )
|
||||||
change=changes.find_by_revision_and_path(
|
change = filechanges.find_by_revision_and_path(
|
||||||
entry.lastrev.revision,
|
entry.lastrev.revision,
|
||||||
scm.with_leading_slash(entry.path) )
|
scm.with_leading_slash(entry.path) )
|
||||||
if change
|
if change
|
||||||
@@ -94,7 +94,7 @@ class Repository::Cvs < Repository
|
|||||||
if rev_to.to_i > 0
|
if rev_to.to_i > 0
|
||||||
changeset_to = changesets.find_by_revision(rev_to)
|
changeset_to = changesets.find_by_revision(rev_to)
|
||||||
end
|
end
|
||||||
changeset_from.changes.each() do |change_from|
|
changeset_from.filechanges.each() do |change_from|
|
||||||
revision_from = nil
|
revision_from = nil
|
||||||
revision_to = nil
|
revision_to = nil
|
||||||
if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
|
if path.nil? || (change_from.path.starts_with? scm.with_leading_slash(path))
|
||||||
@@ -102,7 +102,7 @@ class Repository::Cvs < Repository
|
|||||||
end
|
end
|
||||||
if revision_from
|
if revision_from
|
||||||
if changeset_to
|
if changeset_to
|
||||||
changeset_to.changes.each() do |change_to|
|
changeset_to.filechanges.each() do |change_to|
|
||||||
revision_to = change_to.revision if change_to.path == change_from.path
|
revision_to = change_to.revision if change_to.path == change_from.path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -133,7 +133,7 @@ class Repository::Cvs < Repository
|
|||||||
# only add the change to the database, if it doen't exists. the cvs log
|
# only add the change to the database, if it doen't exists. the cvs log
|
||||||
# is not exclusive at all.
|
# is not exclusive at all.
|
||||||
tmp_time = revision.time.clone
|
tmp_time = revision.time.clone
|
||||||
unless changes.find_by_path_and_revision(
|
unless filechanges.find_by_path_and_revision(
|
||||||
scm.with_leading_slash(revision.paths[0][:path]),
|
scm.with_leading_slash(revision.paths[0][:path]),
|
||||||
revision.paths[0][:revision]
|
revision.paths[0][:revision]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class Repository::Darcs < Repository
|
|||||||
return nil if patch_from.nil?
|
return nil if patch_from.nil?
|
||||||
patch_to = changesets.find_by_revision(rev_to) if rev_to
|
patch_to = changesets.find_by_revision(rev_to) if rev_to
|
||||||
if path.blank?
|
if path.blank?
|
||||||
path = patch_from.changes.collect{|change| change.path}.join(' ')
|
path = patch_from.filechanges.collect{|change| change.path}.join(' ')
|
||||||
end
|
end
|
||||||
patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil
|
patch_from ? scm.diff(path, patch_from.scmid, patch_to ? patch_to.scmid : nil) : nil
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
<div class="next-prev-links contextual">
|
<div class="next-prev-links contextual">
|
||||||
<%= link_to_if @prev_issue_id,
|
<%= link_to_if @prev_issue_id,
|
||||||
"\xc2\xab #{l(:label_previous)}",
|
"\xc2\xab #{l(:label_previous)}",
|
||||||
issue_path(@prev_issue_id),
|
(@prev_issue_id ? issue_path(@prev_issue_id) : nil),
|
||||||
:title => "##{@prev_issue_id}" %> |
|
:title => "##{@prev_issue_id}" %> |
|
||||||
<% if @issue_position && @issue_count %>
|
<% if @issue_position && @issue_count %>
|
||||||
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
|
<span class="position"><%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %></span> |
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= link_to_if @next_issue_id,
|
<%= link_to_if @next_issue_id,
|
||||||
"#{l(:label_next)} \xc2\xbb",
|
"#{l(:label_next)} \xc2\xbb",
|
||||||
issue_path(@next_issue_id),
|
(@next_issue_id ? issue_path(@next_issue_id) : nil),
|
||||||
:title => "##{@next_issue_id}" %>
|
:title => "##{@next_issue_id}" %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<%= labelled_remote_form_for @wiki,
|
<%= labelled_remote_form_for @wiki,
|
||||||
:as => :wiki,
|
:as => :wiki,
|
||||||
:url => { :controller => 'wikis', :action => 'edit', :id => @project } do |f| %>
|
:url => { :controller => 'wikis', :action => 'edit', :id => @project }, :method => 'post' do |f| %>
|
||||||
|
|
||||||
<%= error_messages_for 'wiki' %>
|
<%= error_messages_for 'wiki' %>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<h2><%= l(:label_repository) %></h2>
|
<h2><%= l(:label_repository) %></h2>
|
||||||
|
|
||||||
<%= labelled_form_for :repository, @repository, :url => repository_path(@path), :html => {:method => :put} do |f| %>
|
<%= labelled_form_for :repository, @repository, :url => repository_path(@repository), :html => {:method => :put} do |f| %>
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
:id => @project,
|
:id => @project,
|
||||||
:repository_id => @repository.identifier_param,
|
:repository_id => @repository.identifier_param,
|
||||||
:path => "",
|
:path => "",
|
||||||
:rev => @changeset.identifier) if @changeset.changes.any? %></p>
|
:rev => @changeset.identifier) if @changeset.filechanges.any? %></p>
|
||||||
|
|
||||||
<div class="changeset-changes">
|
<div class="changeset-changes">
|
||||||
<%= render_changeset_changes %>
|
<%= render_changeset_changes %>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<h2><%= l(:label_spent_time) %></h2>
|
<h2><%= l(:label_spent_time) %></h2>
|
||||||
|
|
||||||
<%= labelled_form_for @time_entry, :url => time_entries_path do |f| %>
|
<%= labelled_form_for @time_entry, :url => time_entries_path do |f| %>
|
||||||
|
<%= hidden_field_tag 'project_id', params[:project_id] if params[:project_id] %>
|
||||||
<%= render :partial => 'form', :locals => {:f => f} %>
|
<%= render :partial => 'form', :locals => {:f => f} %>
|
||||||
<%= submit_tag l(:button_create) %>
|
<%= submit_tag l(:button_create) %>
|
||||||
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
<%= submit_tag l(:button_create_and_continue), :name => 'continue' %>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification),
|
<%= select_tag 'user[mail_notification]', options_for_select(user_mail_notification_options(@user), @user.mail_notification),
|
||||||
:onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
|
:onchange => 'if (this.value == "selected") {Element.show("notified-projects")} else {Element.hide("notified-projects")}' %>
|
||||||
</p>
|
</p>
|
||||||
<% content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>
|
<%= content_tag 'div', :id => 'notified-projects', :style => (@user.mail_notification == 'selected' ? '' : 'display:none;') do %>
|
||||||
<p><% @user.projects.each do |project| %>
|
<p><% @user.projects.each do |project| %>
|
||||||
<label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
|
<label><%= check_box_tag 'notified_project_ids[]', project.id, @user.notified_projects_ids.include?(project.id) %> <%=h project.name %></label><br />
|
||||||
<% end %></p>
|
<% end %></p>
|
||||||
|
|||||||
@@ -4,6 +4,15 @@ 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-06-05 v2.0.2
|
||||||
|
|
||||||
|
* Defect #11032: Project list is not shown when "For any event on the selected projects only..." is selected on user edit panel
|
||||||
|
* Defect #11038: "Create and continue" should preserve project, issue and activity when logging time
|
||||||
|
* Defect #11046: Redmine.pm does not support "bind as user" ldap authentication
|
||||||
|
* Defect #11051: reposman.rb fails in 1.4.2 because of missing require for rubygems
|
||||||
|
* Defect #11085: Wiki start page can't be changed
|
||||||
|
* Feature #11084: Update Rails to 3.2.5
|
||||||
|
|
||||||
== 2012-05-28 v2.0.1
|
== 2012-05-28 v2.0.1
|
||||||
|
|
||||||
* Defect #10923: After creating a new Version Redmine jumps back to "Information"
|
* Defect #10923: After creating a new Version Redmine jumps back to "Information"
|
||||||
|
|||||||
@@ -366,12 +366,19 @@ sub is_member {
|
|||||||
);
|
);
|
||||||
$sthldap->execute($auth_source_id);
|
$sthldap->execute($auth_source_id);
|
||||||
while (my @rowldap = $sthldap->fetchrow_array) {
|
while (my @rowldap = $sthldap->fetchrow_array) {
|
||||||
|
my $bind_as = $rowldap[3] ? $rowldap[3] : "";
|
||||||
|
my $bind_pw = $rowldap[4] ? $rowldap[4] : "";
|
||||||
|
if ($bind_as =~ m/\$login/) {
|
||||||
|
# replace $login with $redmine_user and use $redmine_pass
|
||||||
|
$bind_as =~ s/\$login/$redmine_user/g;
|
||||||
|
$bind_pw = $redmine_pass
|
||||||
|
}
|
||||||
my $ldap = Authen::Simple::LDAP->new(
|
my $ldap = Authen::Simple::LDAP->new(
|
||||||
host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0],
|
host => ($rowldap[2] eq "1" || $rowldap[2] eq "t") ? "ldaps://$rowldap[0]:$rowldap[1]" : $rowldap[0],
|
||||||
port => $rowldap[1],
|
port => $rowldap[1],
|
||||||
basedn => $rowldap[5],
|
basedn => $rowldap[5],
|
||||||
binddn => $rowldap[3] ? $rowldap[3] : "",
|
binddn => $bind_as,
|
||||||
bindpw => $rowldap[4] ? $rowldap[4] : "",
|
bindpw => $bind_pw,
|
||||||
filter => "(".$rowldap[6]."=%s)"
|
filter => "(".$rowldap[6]."=%s)"
|
||||||
);
|
);
|
||||||
my $method = $r->method;
|
my $method = $r->method;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
require 'optparse'
|
require 'optparse'
|
||||||
require 'find'
|
require 'find'
|
||||||
require 'etc'
|
require 'etc'
|
||||||
|
require 'rubygems'
|
||||||
|
|
||||||
Version = "1.4"
|
Version = "1.4"
|
||||||
SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
|
SUPPORTED_SCM = %w( Subversion Darcs Mercurial Bazaar Git Filesystem )
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ module Redmine
|
|||||||
module VERSION #:nodoc:
|
module VERSION #:nodoc:
|
||||||
MAJOR = 2
|
MAJOR = 2
|
||||||
MINOR = 0
|
MINOR = 0
|
||||||
TINY = 1
|
TINY = 2
|
||||||
|
|
||||||
# Branch values:
|
# Branch values:
|
||||||
# * official release: nil
|
# * official release: nil
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ namespace :redmine do
|
|||||||
set_inheritance_column :none
|
set_inheritance_column :none
|
||||||
|
|
||||||
# ticket changes: only migrate status changes and comments
|
# ticket changes: only migrate status changes and comments
|
||||||
has_many :changes, :class_name => "TracTicketChange", :foreign_key => :ticket
|
has_many :ticket_changes, :class_name => "TracTicketChange", :foreign_key => :ticket
|
||||||
has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
|
has_many :customs, :class_name => "TracTicketCustom", :foreign_key => :ticket
|
||||||
|
|
||||||
def attachments
|
def attachments
|
||||||
@@ -487,7 +487,7 @@ namespace :redmine do
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Comments and status/resolution changes
|
# Comments and status/resolution changes
|
||||||
ticket.changes.group_by(&:time).each do |time, changeset|
|
ticket.ticket_changes.group_by(&:time).each do |time, changeset|
|
||||||
status_change = changeset.select {|change| change.field == 'status'}.first
|
status_change = changeset.select {|change| change.field == 'status'}.first
|
||||||
resolution_change = changeset.select {|change| change.field == 'resolution'}.first
|
resolution_change = changeset.select {|change| change.field == 'resolution'}.first
|
||||||
comment_change = changeset.select {|change| change.field == 'comment'}.first
|
comment_change = changeset.select {|change| change.field == 'comment'}.first
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
# Default activity selected
|
# Default activity selected
|
||||||
assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
|
assert_tag :tag => 'option', :attributes => { :selected => 'selected' },
|
||||||
:content => 'Development'
|
:content => 'Development'
|
||||||
|
assert_select 'input[name=project_id][value=1]'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_get_new_should_only_show_active_time_entry_activities
|
def test_get_new_should_only_show_active_time_entry_activities
|
||||||
@@ -61,6 +62,18 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'new'
|
assert_template 'new'
|
||||||
assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}
|
assert_tag 'select', :attributes => {:name => 'time_entry[project_id]'}
|
||||||
|
assert_select 'input[name=project_id]', 0
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_new_without_project_should_prefill_the_form
|
||||||
|
@request.session[:user_id] = 3
|
||||||
|
get :new, :time_entry => {:project_id => '1'}
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'new'
|
||||||
|
assert_select 'select[name=?]', 'time_entry[project_id]' do
|
||||||
|
assert_select 'option[value=1][selected=selected]'
|
||||||
|
end
|
||||||
|
assert_select 'input[name=project_id]', 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_without_project_should_deny_without_permission
|
def test_new_without_project_should_deny_without_permission
|
||||||
@@ -144,7 +157,7 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
:spent_on => '2008-03-14',
|
:spent_on => '2008-03-14',
|
||||||
:hours => '7.3'},
|
:hours => '7.3'},
|
||||||
:continue => '1'
|
:continue => '1'
|
||||||
assert_redirected_to '/projects/ecookbook/time_entries/new'
|
assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D='
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_and_continue_with_issue_id
|
def test_create_and_continue_with_issue_id
|
||||||
@@ -155,7 +168,7 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
:spent_on => '2008-03-14',
|
:spent_on => '2008-03-14',
|
||||||
:hours => '7.3'},
|
:hours => '7.3'},
|
||||||
:continue => '1'
|
:continue => '1'
|
||||||
assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new'
|
assert_redirected_to '/projects/ecookbook/issues/1/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=1'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_and_continue_without_project
|
def test_create_and_continue_without_project
|
||||||
@@ -167,7 +180,7 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
:hours => '7.3'},
|
:hours => '7.3'},
|
||||||
:continue => '1'
|
:continue => '1'
|
||||||
|
|
||||||
assert_redirected_to '/time_entries/new'
|
assert_redirected_to '/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1'
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_without_log_time_permission_should_be_denied
|
def test_create_without_log_time_permission_should_be_denied
|
||||||
|
|||||||
@@ -311,6 +311,29 @@ class UsersControllerTest < ActionController::TestCase
|
|||||||
assert u.check_password?('newpass')
|
assert u.check_password?('newpass')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_update_notified_project
|
||||||
|
get :edit, :id => 2
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'edit'
|
||||||
|
u = User.find(2)
|
||||||
|
assert_equal [1, 2, 5], u.projects.collect{|p| p.id}.sort
|
||||||
|
assert_equal [1, 2, 5], u.notified_projects_ids.sort
|
||||||
|
assert_tag :tag => 'input',
|
||||||
|
:attributes => {
|
||||||
|
:id => 'notified_project_ids_',
|
||||||
|
:value => 1,
|
||||||
|
}
|
||||||
|
assert_equal 'all', u.mail_notification
|
||||||
|
put :update, :id => 2,
|
||||||
|
:user => {
|
||||||
|
:mail_notification => 'selected',
|
||||||
|
},
|
||||||
|
:notified_project_ids => [1, 2]
|
||||||
|
u = User.find(2)
|
||||||
|
assert_equal 'selected', u.mail_notification
|
||||||
|
assert_equal [1, 2], u.notified_projects_ids.sort
|
||||||
|
end
|
||||||
|
|
||||||
def test_destroy
|
def test_destroy
|
||||||
assert_difference 'User.count', -1 do
|
assert_difference 'User.count', -1 do
|
||||||
delete :destroy, :id => 2
|
delete :destroy, :id => 2
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class GroupTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
def test_roles_removed_when_removing_user_from_group
|
def test_roles_removed_when_removing_user_from_group
|
||||||
assert User.find(8).member_of?(Project.find(5))
|
assert User.find(8).member_of?(Project.find(5))
|
||||||
User.find(8).groups.clear
|
User.find(8).groups = []
|
||||||
assert !User.find(8).member_of?(Project.find(5))
|
assert !User.find(8).member_of?(Project.find(5))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 9, @repository.changes.count
|
assert_equal 9, @repository.filechanges.count
|
||||||
assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments
|
assert_equal 'Initial import', @repository.changesets.find_by_revision('1').comments
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
assert_equal CHANGESETS_NUM, @repository.changesets.count
|
||||||
assert_equal 16, @repository.changes.count
|
assert_equal 16, @repository.filechanges.count
|
||||||
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
|
assert_not_nil @repository.changesets.find_by_comments('Two files changed')
|
||||||
|
|
||||||
r2 = @repository.changesets.find_by_revision('2')
|
r2 = @repository.changesets.find_by_revision('2')
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class RepositoryDarcsTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 13, @repository.changes.count
|
assert_equal 13, @repository.filechanges.count
|
||||||
assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
|
assert_equal "Initial commit.", @repository.changesets.find_by_revision('1').comments
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,11 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase
|
|||||||
if File.directory?(REPOSITORY_PATH)
|
if File.directory?(REPOSITORY_PATH)
|
||||||
def test_fetch_changesets
|
def test_fetch_changesets
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
assert_equal 0, @repository.changes.count
|
assert_equal 0, @repository.filechanges.count
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@project.reload
|
@project.reload
|
||||||
assert_equal 0, @repository.changesets.count
|
assert_equal 0, @repository.changesets.count
|
||||||
assert_equal 0, @repository.changes.count
|
assert_equal 0, @repository.filechanges.count
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_entries
|
def test_entries
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 39, @repository.changes.count
|
assert_equal 39, @repository.filechanges.count
|
||||||
|
|
||||||
commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
|
commit = @repository.changesets.find_by_revision("7234cb2750b63f47bff735edc50a1c0a433c2518")
|
||||||
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
|
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", commit.scmid
|
||||||
@@ -111,8 +111,8 @@ class RepositoryGitTest < ActiveSupport::TestCase
|
|||||||
# TODO: add a commit with commit time <> author time to the test repository
|
# TODO: add a commit with commit time <> author time to the test repository
|
||||||
assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
|
assert_equal "2007-12-14 09:22:52".to_time, commit.committed_on
|
||||||
assert_equal "2007-12-14".to_date, commit.commit_date
|
assert_equal "2007-12-14".to_date, commit.commit_date
|
||||||
assert_equal 3, commit.changes.count
|
assert_equal 3, commit.filechanges.count
|
||||||
change = commit.changes.sort_by(&:path).first
|
change = commit.filechanges.sort_by(&:path).first
|
||||||
assert_equal "README", change.path
|
assert_equal "README", change.path
|
||||||
assert_equal nil, change.from_path
|
assert_equal nil, change.from_path
|
||||||
assert_equal "A", change.action
|
assert_equal "A", change.action
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
|||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
@project.reload
|
@project.reload
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 46, @repository.changes.count
|
assert_equal 46, @repository.filechanges.count
|
||||||
assert_equal "Initial import.\nThe repository contains 3 files.",
|
assert_equal "Initial import.\nThe repository contains 3 files.",
|
||||||
@repository.changesets.find_by_revision('0').comments
|
@repository.changesets.find_by_revision('0').comments
|
||||||
end
|
end
|
||||||
@@ -214,7 +214,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
cs1 = @repository.changesets.find_by_revision('13')
|
cs1 = @repository.changesets.find_by_revision('13')
|
||||||
assert_not_nil cs1
|
assert_not_nil cs1
|
||||||
c1 = cs1.changes.sort_by(&:path)
|
c1 = cs1.filechanges.sort_by(&:path)
|
||||||
assert_equal 2, c1.size
|
assert_equal 2, c1.size
|
||||||
|
|
||||||
assert_equal 'A', c1[0].action
|
assert_equal 'A', c1[0].action
|
||||||
@@ -227,7 +227,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
|||||||
assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
|
assert_equal '/sql_escape/underscore_dir/understrike_file.txt', c1[1].from_path
|
||||||
|
|
||||||
cs2 = @repository.changesets.find_by_revision('15')
|
cs2 = @repository.changesets.find_by_revision('15')
|
||||||
c2 = cs2.changes
|
c2 = cs2.filechanges
|
||||||
assert_equal 1, c2.size
|
assert_equal 1, c2.size
|
||||||
|
|
||||||
assert_equal 'A', c2[0].action
|
assert_equal 'A', c2[0].action
|
||||||
@@ -236,7 +236,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
|
|||||||
assert_equal '933ca60293d7', c2[0].from_revision
|
assert_equal '933ca60293d7', c2[0].from_revision
|
||||||
|
|
||||||
cs3 = @repository.changesets.find_by_revision('19')
|
cs3 = @repository.changesets.find_by_revision('19')
|
||||||
c3 = cs3.changes
|
c3 = cs3.filechanges
|
||||||
assert_equal 1, c3.size
|
assert_equal 1, c3.size
|
||||||
assert_equal 'A', c3[0].action
|
assert_equal 'A', c3[0].action
|
||||||
assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
|
assert_equal "/latin-1-dir/test-#{@char_1}-1.txt", c3[0].path
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal NUM_REV, @repository.changesets.count
|
assert_equal NUM_REV, @repository.changesets.count
|
||||||
assert_equal 20, @repository.changes.count
|
assert_equal 20, @repository.filechanges.count
|
||||||
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
assert_equal 'Initial import.', @repository.changesets.find_by_revision('1').comments
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -99,7 +99,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase
|
|||||||
@project.reload
|
@project.reload
|
||||||
|
|
||||||
assert_equal 1, @repository.changesets.count, 'Expected to see 1 revision'
|
assert_equal 1, @repository.changesets.count, 'Expected to see 1 revision'
|
||||||
assert_equal 2, @repository.changes.count, 'Expected to see 2 changes, dir add and file add'
|
assert_equal 2, @repository.filechanges.count, 'Expected to see 2 changes, dir add and file add'
|
||||||
|
|
||||||
entries = @repository.entries('')
|
entries = @repository.entries('')
|
||||||
assert_not_nil entries, 'Expect to find entries'
|
assert_not_nil entries, 'Expect to find entries'
|
||||||
|
|||||||
@@ -98,8 +98,10 @@ class RepositoryTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy
|
def test_destroy
|
||||||
changesets = Changeset.where("repository_id = 10").all.count
|
repository = Repository.find(10)
|
||||||
changes = Changeset.joins([:changes]).where("repository_id = 10").all.count
|
changesets = repository.changesets.count
|
||||||
|
changes = repository.filechanges.count
|
||||||
|
|
||||||
assert_difference 'Changeset.count', -changesets do
|
assert_difference 'Changeset.count', -changesets do
|
||||||
assert_difference 'Change.count', -changes do
|
assert_difference 'Change.count', -changes do
|
||||||
Repository.find(10).destroy
|
Repository.find(10).destroy
|
||||||
|
|||||||
Reference in New Issue
Block a user