Fix trailing whitespace
This commit is contained in:
parent
19f2ccd496
commit
185edcd283
@ -55,7 +55,7 @@ class AutoCompletesController < ApplicationController
|
|||||||
else
|
else
|
||||||
user_finder = User
|
user_finder = User
|
||||||
end
|
end
|
||||||
|
|
||||||
@users = user_finder.active.like(params[:q]).find(:all, :limit => 100) - @removed_users
|
@users = user_finder.active.like(params[:q]).find(:all, :limit => 100) - @removed_users
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
@ -65,7 +65,7 @@ class AutoCompletesController < ApplicationController
|
|||||||
@projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @principal.projects
|
@projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @principal.projects
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_project
|
def find_project
|
||||||
|
@ -43,7 +43,7 @@ class DocumentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@document = @project.documents.build(params[:document])
|
@document = @project.documents.build(params[:document])
|
||||||
if request.post?
|
if request.post?
|
||||||
if User.current.allowed_to?(:add_document_watchers, @project) && params[:document]['watcher_user_ids'].present?
|
if User.current.allowed_to?(:add_document_watchers, @project) && params[:document]['watcher_user_ids'].present?
|
||||||
@document.watcher_user_ids = params[:document]['watcher_user_ids']
|
@document.watcher_user_ids = params[:document]['watcher_user_ids']
|
||||||
|
@ -138,7 +138,7 @@ class GroupsController < ApplicationController
|
|||||||
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
|
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
|
||||||
@membership.save if request.post?
|
@membership.save if request.post?
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @membership.valid?
|
if @membership.valid?
|
||||||
format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
|
format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }
|
||||||
|
@ -101,7 +101,7 @@ class JournalsController < ApplicationController
|
|||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_journal
|
def find_journal
|
||||||
|
@ -17,7 +17,7 @@ class WatchersController < ApplicationController
|
|||||||
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
|
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
|
||||||
before_filter :authorize, :only => [:new, :destroy]
|
before_filter :authorize, :only => [:new, :destroy]
|
||||||
before_filter :authorize_access_to_object, :only => [:new, :destroy]
|
before_filter :authorize_access_to_object, :only => [:new, :destroy]
|
||||||
|
|
||||||
verify :method => :post,
|
verify :method => :post,
|
||||||
:only => [ :watch, :unwatch ],
|
:only => [ :watch, :unwatch ],
|
||||||
:render => { :nothing => true, :status => :method_not_allowed }
|
:render => { :nothing => true, :status => :method_not_allowed }
|
||||||
@ -40,7 +40,7 @@ class WatchersController < ApplicationController
|
|||||||
@watcher.watchable = @watched
|
@watcher.watchable = @watched
|
||||||
@watcher.save if request.post?
|
@watcher.save if request.post?
|
||||||
end if params[:user_ids].present?
|
end if params[:user_ids].present?
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to :back }
|
format.html { redirect_to :back }
|
||||||
format.js do
|
format.js do
|
||||||
@ -117,5 +117,5 @@ private
|
|||||||
deny_access
|
deny_access
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -26,7 +26,7 @@ class Group < Principal
|
|||||||
def mails
|
def mails
|
||||||
users.collect(&:mail)
|
users.collect(&:mail)
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
lastname.to_s
|
lastname.to_s
|
||||||
end
|
end
|
||||||
|
@ -302,7 +302,7 @@ class Mailer < ActionMailer::Base
|
|||||||
project = ''
|
project = ''
|
||||||
url = ''
|
url = ''
|
||||||
end
|
end
|
||||||
|
|
||||||
subject "[#{project}] #{l(:label_mail_handler_confirmation, :subject => email_subject)}"
|
subject "[#{project}] #{l(:label_mail_handler_confirmation, :subject => email_subject)}"
|
||||||
body(:object => object,
|
body(:object => object,
|
||||||
:url => url)
|
:url => url)
|
||||||
@ -315,7 +315,7 @@ class Mailer < ActionMailer::Base
|
|||||||
body({})
|
body({})
|
||||||
render_multipart('mail_handler_unauthorized_action', body)
|
render_multipart('mail_handler_unauthorized_action', body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def mail_handler_missing_information(user, email_subject, error_message)
|
def mail_handler_missing_information(user, email_subject, error_message)
|
||||||
recipients user.mail
|
recipients user.mail
|
||||||
subject l(:label_mail_handler_failure, :subject => email_subject)
|
subject l(:label_mail_handler_failure, :subject => email_subject)
|
||||||
|
@ -123,7 +123,7 @@ class Principal < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
roles
|
roles
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
# Make sure we don't try to insert NULL values (see #4632)
|
# Make sure we don't try to insert NULL values (see #4632)
|
||||||
|
@ -82,7 +82,7 @@ class Project < ActiveRecord::Base
|
|||||||
named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
|
named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
|
||||||
named_scope :all_public, { :conditions => { :is_public => true } }
|
named_scope :all_public, { :conditions => { :is_public => true } }
|
||||||
named_scope :visible, lambda { { :conditions => Project.visible_by(User.current) } }
|
named_scope :visible, lambda { { :conditions => Project.visible_by(User.current) } }
|
||||||
named_scope :like, lambda {|q|
|
named_scope :like, lambda {|q|
|
||||||
s = "%#{q.to_s.strip.downcase}%"
|
s = "%#{q.to_s.strip.downcase}%"
|
||||||
{
|
{
|
||||||
:conditions => ["LOWER(name) LIKE ?", s]
|
:conditions => ["LOWER(name) LIKE ?", s]
|
||||||
|
@ -221,7 +221,7 @@ class Query < ActiveRecord::Base
|
|||||||
def has_filter?(field)
|
def has_filter?(field)
|
||||||
filters and filters[field]
|
filters and filters[field]
|
||||||
end
|
end
|
||||||
|
|
||||||
def type_for(field)
|
def type_for(field)
|
||||||
available_filters[field][:type] if available_filters.has_key?(field)
|
available_filters[field][:type] if available_filters.has_key?(field)
|
||||||
end
|
end
|
||||||
@ -647,7 +647,7 @@ class Query < ActiveRecord::Base
|
|||||||
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
|
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a SQL clause for a date or datetime field.
|
# Returns a SQL clause for a date or datetime field.
|
||||||
def date_clause(table, field, from, to)
|
def date_clause(table, field, from, to)
|
||||||
s = []
|
s = []
|
||||||
@ -659,7 +659,7 @@ class Query < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
s.join(' AND ')
|
s.join(' AND ')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a SQL clause for a date or datetime field using relative dates.
|
# Returns a SQL clause for a date or datetime field using relative dates.
|
||||||
def relative_date_clause(table, field, days_from, days_to)
|
def relative_date_clause(table, field, days_from, days_to)
|
||||||
date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))
|
date_clause(table, field, (days_from ? Date.today + days_from : nil), (days_to ? Date.today + days_to : nil))
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
class Watcher < ActiveRecord::Base
|
class Watcher < ActiveRecord::Base
|
||||||
belongs_to :watchable, :polymorphic => true
|
belongs_to :watchable, :polymorphic => true
|
||||||
belongs_to :user, :class_name => 'Principal', :foreign_key => 'user_id'
|
belongs_to :user, :class_name => 'Principal', :foreign_key => 'user_id'
|
||||||
|
|
||||||
validates_presence_of :user
|
validates_presence_of :user
|
||||||
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
|
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
:url => { :controller => 'auto_completes', :action => 'projects', :id => principal },
|
:url => { :controller => 'auto_completes', :action => 'projects', :id => principal },
|
||||||
:with => 'q')
|
:with => 'q')
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<div id="projects">
|
<div id="projects">
|
||||||
<%= principals_check_box_tags 'project_ids[]', projects %>
|
<%= principals_check_box_tags 'project_ids[]', projects %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3>
|
<h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3>
|
||||||
|
|
||||||
<% if User.current.allowed_to?("add_#{watched.class.name.underscore}_watchers".to_sym, @project) %>
|
<% if User.current.allowed_to?("add_#{watched.class.name.underscore}_watchers".to_sym, @project) %>
|
||||||
<% remote_form_for(:watcher, @watcher,
|
<% remote_form_for(:watcher, @watcher,
|
||||||
:url => {:controller => 'watchers',
|
:url => {:controller => 'watchers',
|
||||||
:action => 'new',
|
:action => 'new',
|
||||||
:object_type => watched.class.name.underscore,
|
:object_type => watched.class.name.underscore,
|
||||||
@ -20,7 +20,7 @@
|
|||||||
:url => auto_complete_users_path(:remove_watchers => watched.id, :klass => watched.class, :include_groups => true),
|
:url => auto_complete_users_path(:remove_watchers => watched.id, :klass => watched.class, :include_groups => true),
|
||||||
:with => 'q')
|
:with => 'q')
|
||||||
%>
|
%>
|
||||||
|
|
||||||
<div id="users">
|
<div id="users">
|
||||||
<%= principals_check_box_tags 'user_ids[]', users %>
|
<%= principals_check_box_tags 'user_ids[]', users %>
|
||||||
</div>
|
</div>
|
||||||
|
@ -950,7 +950,7 @@ en:
|
|||||||
text_display_subprojects: Display subprojects
|
text_display_subprojects: Display subprojects
|
||||||
text_current_project: Current project
|
text_current_project: Current project
|
||||||
text_mail_handler_confirmation_successful: "Your email has been successful added at the following url"
|
text_mail_handler_confirmation_successful: "Your email has been successful added at the following url"
|
||||||
|
|
||||||
default_role_manager: Manager
|
default_role_manager: Manager
|
||||||
default_role_developer: Developer
|
default_role_developer: Developer
|
||||||
default_role_reporter: Reporter
|
default_role_reporter: Reporter
|
||||||
|
@ -96,7 +96,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||||||
map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
|
map.quoted_issue '/issues/:id/quoted', :controller => 'journals', :action => 'new', :id => /\d+/, :conditions => { :method => :post }
|
||||||
map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
|
map.connect '/issues/:id/destroy', :controller => 'issues', :action => 'destroy', :conditions => { :method => :post } # legacy
|
||||||
map.journal_diff '/journals/:id/diff/:field', :controller => 'journals', :action => 'diff', :conditions => { :method => :get }
|
map.journal_diff '/journals/:id/diff/:field', :controller => 'journals', :action => 'diff', :conditions => { :method => :get }
|
||||||
|
|
||||||
map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
|
map.resource :gantt, :path_prefix => '/issues', :controller => 'gantts', :only => [:show, :update]
|
||||||
map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
|
map.resource :gantt, :path_prefix => '/projects/:project_id/issues', :controller => 'gantts', :only => [:show, :update]
|
||||||
map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
|
map.resource :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
Return-Path: <JSmith@somenet.foo>
|
Return-Path: <JSmith@somenet.foo>
|
||||||
Received: from osiris ([127.0.0.1])
|
Received: from osiris ([127.0.0.1])
|
||||||
by OSIRIS
|
by OSIRIS
|
||||||
with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
|
with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
|
||||||
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
|
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
|
||||||
From: "John Smith" <JSmith@somenet.foo>
|
From: "John Smith" <JSmith@somenet.foo>
|
||||||
To: <redmine@somenet.foo>
|
To: <redmine@somenet.foo>
|
||||||
Subject: New ticket on a given project
|
Subject: New ticket on a given project
|
||||||
Date: Sun, 22 Jun 2008 12:28:07 +0200
|
Date: Sun, 22 Jun 2008 12:28:07 +0200
|
||||||
MIME-Version: 1.0
|
MIME-Version: 1.0
|
||||||
Content-Type: text/plain;
|
Content-Type: text/plain;
|
||||||
format=flowed;
|
format=flowed;
|
||||||
charset="iso-8859-1";
|
charset="iso-8859-1";
|
||||||
reply-type=original
|
reply-type=original
|
||||||
Content-Transfer-Encoding: 7bit
|
Content-Transfer-Encoding: 7bit
|
||||||
X-Priority: 3
|
X-Priority: 3
|
||||||
X-MSMail-Priority: Normal
|
X-MSMail-Priority: Normal
|
||||||
X-Mailer: Microsoft Outlook Express 6.00.2900.2869
|
X-Mailer: Microsoft Outlook Express 6.00.2900.2869
|
||||||
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
|
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
|
||||||
|
|
||||||
Test with missing information
|
Test with missing information
|
||||||
|
|
||||||
Project: onlinestore
|
Project: onlinestore
|
||||||
|
@ -77,16 +77,16 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
setup do
|
setup do
|
||||||
get :users, :q => 'complete'
|
get :users, :q => 'complete'
|
||||||
end
|
end
|
||||||
|
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
|
|
||||||
should "render a list of matching users in checkboxes" do
|
should "render a list of matching users in checkboxes" do
|
||||||
assert_select "input[type=checkbox][value=?]", @login.id
|
assert_select "input[type=checkbox][value=?]", @login.id
|
||||||
assert_select "input[type=checkbox][value=?]", @firstname.id
|
assert_select "input[type=checkbox][value=?]", @firstname.id
|
||||||
assert_select "input[type=checkbox][value=?]", @lastname.id
|
assert_select "input[type=checkbox][value=?]", @lastname.id
|
||||||
assert_select "input[type=checkbox][value=?]", @none.id, :count => 0
|
assert_select "input[type=checkbox][value=?]", @none.id, :count => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
should "only show active users" do
|
should "only show active users" do
|
||||||
assert_select "input[type=checkbox][value=?]", @inactive.id, :count => 0
|
assert_select "input[type=checkbox][value=?]", @inactive.id, :count => 0
|
||||||
end
|
end
|
||||||
@ -97,9 +97,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
@group = Group.generate(:lastname => 'Complete Group').reload
|
@group = Group.generate(:lastname => 'Complete Group').reload
|
||||||
get :users, :q => 'complete', :include_groups => true
|
get :users, :q => 'complete', :include_groups => true
|
||||||
end
|
end
|
||||||
|
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
|
|
||||||
should "include matching groups" do
|
should "include matching groups" do
|
||||||
assert_select "input[type=checkbox][value=?]", @group.id
|
assert_select "input[type=checkbox][value=?]", @group.id
|
||||||
end
|
end
|
||||||
@ -113,9 +113,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
@group.users << @firstname
|
@group.users << @firstname
|
||||||
get :users, :q => 'complete', :remove_group_members => @group.id
|
get :users, :q => 'complete', :remove_group_members => @group.id
|
||||||
end
|
end
|
||||||
|
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
|
|
||||||
should "not include existing members of the Group" do
|
should "not include existing members of the Group" do
|
||||||
assert_select "input[type=checkbox][value=?]", @lastname.id
|
assert_select "input[type=checkbox][value=?]", @lastname.id
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
assert_select "input[type=checkbox][value=?]", @firstname.id, :count => 0
|
assert_select "input[type=checkbox][value=?]", @firstname.id, :count => 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "restrict by removing issue watchers" do
|
context "restrict by removing issue watchers" do
|
||||||
setup do
|
setup do
|
||||||
@issue = Issue.find(2)
|
@issue = Issue.find(2)
|
||||||
@ -131,9 +131,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
@issue.add_watcher(@firstname)
|
@issue.add_watcher(@firstname)
|
||||||
get :users, :q => 'complete', :remove_watchers => @issue.id, :klass => 'Issue'
|
get :users, :q => 'complete', :remove_watchers => @issue.id, :klass => 'Issue'
|
||||||
end
|
end
|
||||||
|
|
||||||
should_respond_with :success
|
should_respond_with :success
|
||||||
|
|
||||||
should "not include existing watchers" do
|
should "not include existing watchers" do
|
||||||
assert_select "input[type=checkbox][value=?]", @lastname.id
|
assert_select "input[type=checkbox][value=?]", @lastname.id
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
assert_response 403
|
assert_response 403
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with a valid search' do
|
context 'with a valid search' do
|
||||||
setup do
|
setup do
|
||||||
@user = User.generate_with_protected!
|
@user = User.generate_with_protected!
|
||||||
@ -165,15 +165,15 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
Project.generate!(:name => "This is a Test")
|
Project.generate!(:name => "This is a Test")
|
||||||
]
|
]
|
||||||
Project.generate!(:name => "No match")
|
Project.generate!(:name => "No match")
|
||||||
|
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
post :projects, {
|
post :projects, {
|
||||||
:id => @user.id,
|
:id => @user.id,
|
||||||
:q => 'TeST'
|
:q => 'TeST'
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
should_assign_to(:principal) { @user }
|
should_assign_to(:principal) { @user }
|
||||||
should_assign_to(:projects) { @projects }
|
should_assign_to(:projects) { @projects }
|
||||||
should_render_template :projects
|
should_render_template :projects
|
||||||
@ -183,18 +183,18 @@ class AutoCompletesControllerTest < ActionController::TestCase
|
|||||||
setup do
|
setup do
|
||||||
@user = User.generate_with_protected!
|
@user = User.generate_with_protected!
|
||||||
Project.generate!(:name => "Test")
|
Project.generate!(:name => "Test")
|
||||||
|
|
||||||
@request.session[:user_id] = 1
|
@request.session[:user_id] = 1
|
||||||
post :projects, {
|
post :projects, {
|
||||||
:id => @user.id,
|
:id => @user.id,
|
||||||
:q => 'nothing'
|
:q => 'nothing'
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
should_assign_to(:principal) { @user }
|
should_assign_to(:principal) { @user }
|
||||||
should_assign_to(:projects) { [] }
|
should_assign_to(:projects) { [] }
|
||||||
should_render_template :projects
|
should_render_template :projects
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -87,7 +87,7 @@ LOREM
|
|||||||
should "allow adding watchers" do
|
should "allow adding watchers" do
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
set_tmp_attachments_directory
|
set_tmp_attachments_directory
|
||||||
|
|
||||||
post(:new,
|
post(:new,
|
||||||
:project_id => 'ecookbook',
|
:project_id => 'ecookbook',
|
||||||
:document => {
|
:document => {
|
||||||
@ -99,14 +99,14 @@ LOREM
|
|||||||
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}})
|
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}})
|
||||||
|
|
||||||
assert_redirected_to '/projects/ecookbook/documents'
|
assert_redirected_to '/projects/ecookbook/documents'
|
||||||
|
|
||||||
document = Document.find_by_title('DocumentsControllerTest#test_post_new')
|
document = Document.find_by_title('DocumentsControllerTest#test_post_new')
|
||||||
assert_not_nil document
|
assert_not_nil document
|
||||||
assert document.watched_by?(User.find(2))
|
assert document.watched_by?(User.find(2))
|
||||||
assert document.watched_by?(User.find(3))
|
assert document.watched_by?(User.find(3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "POST #edit" do
|
context "POST #edit" do
|
||||||
setup do
|
setup do
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
@ -115,7 +115,7 @@ LOREM
|
|||||||
@document = Document.generate!(:project => Project.find('ecookbook'),
|
@document = Document.generate!(:project => Project.find('ecookbook'),
|
||||||
:title => 'Test')
|
:title => 'Test')
|
||||||
end
|
end
|
||||||
|
|
||||||
should "update the document" do
|
should "update the document" do
|
||||||
post(:edit,
|
post(:edit,
|
||||||
:id => @document.id,
|
:id => @document.id,
|
||||||
@ -129,7 +129,7 @@ LOREM
|
|||||||
assert_not_nil @document
|
assert_not_nil @document
|
||||||
assert_equal 'Change', @document.title
|
assert_equal 'Change', @document.title
|
||||||
end
|
end
|
||||||
|
|
||||||
should "allow adding watchers" do
|
should "allow adding watchers" do
|
||||||
post(:edit,
|
post(:edit,
|
||||||
:id => @document.id,
|
:id => @document.id,
|
||||||
@ -146,7 +146,7 @@ LOREM
|
|||||||
assert @document.watched_by?(User.find(3))
|
assert @document.watched_by?(User.find(3))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy
|
def test_destroy
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
post :destroy, :id => 1
|
post :destroy, :id => 1
|
||||||
|
@ -566,7 +566,7 @@ class IssuesControllerTest < ActionController::TestCase
|
|||||||
:custom_field_values => {'2' => 'Value for field 2'}}
|
:custom_field_values => {'2' => 'Value for field 2'}}
|
||||||
end
|
end
|
||||||
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
|
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
|
||||||
|
|
||||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -87,14 +87,14 @@ class JournalsControllerTest < ActionController::TestCase
|
|||||||
@issue = Issue.find(6)
|
@issue = Issue.find(6)
|
||||||
@previous_description = @issue.description
|
@previous_description = @issue.description
|
||||||
@new_description = "New description"
|
@new_description = "New description"
|
||||||
|
|
||||||
assert_difference("Journal.count") do
|
assert_difference("Journal.count") do
|
||||||
@issue.description = @new_description
|
@issue.description = @new_description
|
||||||
assert @issue.save
|
assert @issue.save
|
||||||
end
|
end
|
||||||
@last_journal = @issue.last_journal
|
@last_journal = @issue.last_journal
|
||||||
end
|
end
|
||||||
|
|
||||||
context "without a valid journal" do
|
context "without a valid journal" do
|
||||||
should "return a 404" do
|
should "return a 404" do
|
||||||
get :diff, :id => '0'
|
get :diff, :id => '0'
|
||||||
@ -124,14 +124,14 @@ class JournalsControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
assert_response :forbidden
|
assert_response :forbidden
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with permission to view_issues" do
|
context "with permission to view_issues" do
|
||||||
setup do
|
setup do
|
||||||
get :diff, :id => @last_journal.id, :field => 'description'
|
get :diff, :id => @last_journal.id, :field => 'description'
|
||||||
end
|
end
|
||||||
|
|
||||||
should "create a diff" do
|
should "create a diff" do
|
||||||
assert_not_nil assigns(:diff)
|
assert_not_nil assigns(:diff)
|
||||||
assert assigns(:diff).is_a?(Redmine::Helpers::Diff)
|
assert assigns(:diff).is_a?(Redmine::Helpers::Diff)
|
||||||
@ -140,9 +140,9 @@ class JournalsControllerTest < ActionController::TestCase
|
|||||||
should "render an inline diff" do
|
should "render an inline diff" do
|
||||||
assert_select "#content .text-diff"
|
assert_select "#content .text-diff"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -308,7 +308,7 @@ class UsersControllerTest < ActionController::TestCase
|
|||||||
post :edit_membership, :id => 2, :project_ids => [3,6], :membership => { :role_ids => ['1', '2']}
|
post :edit_membership, :id => 2, :project_ids => [3,6], :membership => { :role_ids => ['1', '2']}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_destroy_membership
|
def test_destroy_membership
|
||||||
post :destroy_membership, :id => 2, :membership_id => 1
|
post :destroy_membership, :id => 2, :membership_id => 1
|
||||||
assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
|
assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'
|
||||||
|
@ -148,7 +148,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_multiple_users_watching_wiki_page
|
def test_new_multiple_users_watching_wiki_page
|
||||||
Role.find(1).add_permission! :add_wiki_page_watchers
|
Role.find(1).add_permission! :add_wiki_page_watchers
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert !@page.watched_by?(User.find(2))
|
assert !@page.watched_by?(User.find(2))
|
||||||
assert !@page.watched_by?(User.find(4))
|
assert !@page.watched_by?(User.find(4))
|
||||||
assert !@page.watched_by?(User.find(7))
|
assert !@page.watched_by?(User.find(7))
|
||||||
|
|
||||||
assert_difference('Watcher.count', 3) do
|
assert_difference('Watcher.count', 3) do
|
||||||
xhr :post, :new, :object_type => 'wiki_page', :object_id => '1', :user_ids => ['2','4','7']
|
xhr :post, :new, :object_type => 'wiki_page', :object_id => '1', :user_ids => ['2','4','7']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -168,7 +168,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert @page.watched_by?(User.find(4))
|
assert @page.watched_by?(User.find(4))
|
||||||
assert @page.watched_by?(User.find(7))
|
assert @page.watched_by?(User.find(7))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_multiple_users_watching_board
|
def test_new_multiple_users_watching_board
|
||||||
Role.find(1).add_permission! :add_board_watchers
|
Role.find(1).add_permission! :add_board_watchers
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
@board = Board.generate!(:project => @project)
|
@board = Board.generate!(:project => @project)
|
||||||
assert !@board.watched_by?(User.find(2))
|
assert !@board.watched_by?(User.find(2))
|
||||||
assert !@board.watched_by?(User.find(4))
|
assert !@board.watched_by?(User.find(4))
|
||||||
|
|
||||||
assert_difference('Watcher.count', 2) do
|
assert_difference('Watcher.count', 2) do
|
||||||
xhr :post, :new, :object_type => 'board', :object_id => @board.id, :user_ids => ['2','4']
|
xhr :post, :new, :object_type => 'board', :object_id => @board.id, :user_ids => ['2','4']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -197,7 +197,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
@message = Message.generate!(:board => @board)
|
@message = Message.generate!(:board => @board)
|
||||||
assert !@message.watched_by?(User.find(2))
|
assert !@message.watched_by?(User.find(2))
|
||||||
assert !@message.watched_by?(User.find(4))
|
assert !@message.watched_by?(User.find(4))
|
||||||
|
|
||||||
assert_difference('Watcher.count', 2) do
|
assert_difference('Watcher.count', 2) do
|
||||||
xhr :post, :new, :object_type => 'message', :object_id => @message.id, :user_ids => ['2','4']
|
xhr :post, :new, :object_type => 'message', :object_id => @message.id, :user_ids => ['2','4']
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -219,7 +219,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert !Issue.find(2).watched_by?(User.find(4))
|
assert !Issue.find(2).watched_by?(User.find(4))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_wiki_page_watcher_without_permission
|
def test_new_wiki_page_watcher_without_permission
|
||||||
Role.find(1).remove_permission! :add_wiki_page_watchers
|
Role.find(1).remove_permission! :add_wiki_page_watchers
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert !WikiPage.find(1).watched_by?(User.find(2))
|
assert !WikiPage.find(1).watched_by?(User.find(2))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_new_board_watcher_without_permission
|
def test_new_board_watcher_without_permission
|
||||||
Role.find(1).remove_permission! :add_board_watchers
|
Role.find(1).remove_permission! :add_board_watchers
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
|
|
||||||
def test_remove_watcher
|
def test_remove_watcher
|
||||||
Role.find(1).add_permission! :delete_issue_watchers
|
Role.find(1).add_permission! :delete_issue_watchers
|
||||||
|
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
assert_difference('Watcher.count', -1) do
|
assert_difference('Watcher.count', -1) do
|
||||||
xhr :post, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
|
xhr :post, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
|
||||||
@ -292,9 +292,9 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
end
|
end
|
||||||
assert !Issue.find(2).watched_by?(@group)
|
assert !Issue.find(2).watched_by?(@group)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_wiki_page_watcher
|
def test_remove_wiki_page_watcher
|
||||||
Role.find(1).add_permission! :delete_wiki_page_watchers
|
Role.find(1).add_permission! :delete_wiki_page_watchers
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
@page = WikiPage.find(1)
|
@page = WikiPage.find(1)
|
||||||
Watcher.create!(:user_id => 2, :watchable => @page)
|
Watcher.create!(:user_id => 2, :watchable => @page)
|
||||||
assert @page.watched_by?(User.find(2))
|
assert @page.watched_by?(User.find(2))
|
||||||
|
|
||||||
assert_difference('Watcher.count', -1) do
|
assert_difference('Watcher.count', -1) do
|
||||||
xhr :post, :destroy, :object_type => 'wiki_page', :object_id => '1', :user_id => '2'
|
xhr :post, :destroy, :object_type => 'wiki_page', :object_id => '1', :user_id => '2'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
@ -355,7 +355,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert Issue.find(2).watched_by?(User.find(3))
|
assert Issue.find(2).watched_by?(User.find(3))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_wiki_page_watcher_without_permission
|
def test_remove_wiki_page_watcher_without_permission
|
||||||
Role.find(1).remove_permission! :delete_wiki_page_watchers
|
Role.find(1).remove_permission! :delete_wiki_page_watchers
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
assert WikiPage.find(1).watched_by?(User.find(2))
|
assert WikiPage.find(1).watched_by?(User.find(2))
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_remove_board_watcher_without_permission
|
def test_remove_board_watcher_without_permission
|
||||||
Role.find(1).remove_permission! :delete_board_watchers
|
Role.find(1).remove_permission! :delete_board_watchers
|
||||||
@project = Project.find(1)
|
@project = Project.find(1)
|
||||||
@ -394,7 +394,7 @@ class WatchersControllerTest < ActionController::TestCase
|
|||||||
@message = Message.generate!(:board => @board)
|
@message = Message.generate!(:board => @board)
|
||||||
Watcher.create!(:user_id => 2, :watchable => @message)
|
Watcher.create!(:user_id => 2, :watchable => @message)
|
||||||
assert @message.watched_by?(User.find(2))
|
assert @message.watched_by?(User.find(2))
|
||||||
|
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
assert_difference('Watcher.count', 0) do
|
assert_difference('Watcher.count', 0) do
|
||||||
xhr :post, :destroy, :object_type => 'message', :object_id => @message.id, :user_id => '2'
|
xhr :post, :destroy, :object_type => 'message', :object_id => @message.id, :user_id => '2'
|
||||||
|
@ -19,7 +19,7 @@ class JournalsTest < ActionController::IntegrationTest
|
|||||||
|
|
||||||
include IntegrationTestHelpers::CapybaraHelpers
|
include IntegrationTestHelpers::CapybaraHelpers
|
||||||
include Capybara::DSL
|
include Capybara::DSL
|
||||||
|
|
||||||
test "showing issue description changes as a diff" do
|
test "showing issue description changes as a diff" do
|
||||||
# Description change
|
# Description change
|
||||||
@issue = Issue.find(1)
|
@issue = Issue.find(1)
|
||||||
@ -30,7 +30,7 @@ class JournalsTest < ActionController::IntegrationTest
|
|||||||
@issue.description = "A new description"
|
@issue.description = "A new description"
|
||||||
assert @issue.save
|
assert @issue.save
|
||||||
end
|
end
|
||||||
|
|
||||||
log_user('jsmith', 'jsmith')
|
log_user('jsmith', 'jsmith')
|
||||||
|
|
||||||
# Issue page
|
# Issue page
|
||||||
|
@ -112,7 +112,7 @@ class RoutingTest < ActionController::IntegrationTest
|
|||||||
context "journals" do
|
context "journals" do
|
||||||
should_route :get, "/journals/100/diff/description", :controller => 'journals', :action => 'diff', :id => '100', :field => 'description'
|
should_route :get, "/journals/100/diff/description", :controller => 'journals', :action => 'diff', :id => '100', :field => 'description'
|
||||||
end
|
end
|
||||||
|
|
||||||
context "issue categories" do
|
context "issue categories" do
|
||||||
should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
|
should_route :get, "/projects/test/issue_categories/new", :controller => 'issue_categories', :action => 'new', :project_id => 'test'
|
||||||
|
|
||||||
@ -354,5 +354,5 @@ class RoutingTest < ActionController::IntegrationTest
|
|||||||
context "auto_completes" do
|
context "auto_completes" do
|
||||||
should_route :get, "/users/auto_complete", :controller => 'auto_completes', :action => 'users'
|
should_route :get, "/users/auto_complete", :controller => 'auto_completes', :action => 'users'
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -68,5 +68,5 @@ class DocumentTest < ActiveSupport::TestCase
|
|||||||
assert document.recipients.include?(user.mail), "Watcher not included in recipients"
|
assert document.recipients.include?(user.mail), "Watcher not included in recipients"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -438,7 +438,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = submit_email('ticket_by_unknown_user.eml')
|
issue = submit_email('ticket_by_unknown_user.eml')
|
||||||
assert_equal false, issue
|
assert_equal false, issue
|
||||||
|
|
||||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_not_nil mail
|
assert_not_nil mail
|
||||||
@ -455,7 +455,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
assert_no_difference('Journal.count') do
|
assert_no_difference('Journal.count') do
|
||||||
assert_equal false, submit_email('ticket_reply.eml')
|
assert_equal false, submit_email('ticket_reply.eml')
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_not_nil mail
|
assert_not_nil mail
|
||||||
@ -470,7 +470,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = submit_email('ticket_with_attachment.eml') # No project set
|
issue = submit_email('ticket_with_attachment.eml') # No project set
|
||||||
assert_equal false, issue
|
assert_equal false, issue
|
||||||
|
|
||||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_not_nil mail
|
assert_not_nil mail
|
||||||
@ -490,7 +490,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = submit_email('ticket_on_project_with_missing_information.eml')
|
issue = submit_email('ticket_on_project_with_missing_information.eml')
|
||||||
assert_equal false, issue
|
assert_equal false, issue
|
||||||
|
|
||||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_not_nil mail
|
assert_not_nil mail
|
||||||
@ -505,7 +505,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
should "deliver an email confirmation when configured" do
|
should "deliver an email confirmation when configured" do
|
||||||
ActionMailer::Base.deliveries.clear
|
ActionMailer::Base.deliveries.clear
|
||||||
issue = submit_email('ticket_on_given_project.eml')
|
issue = submit_email('ticket_on_given_project.eml')
|
||||||
|
|
||||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_not_nil mail
|
assert_not_nil mail
|
||||||
@ -526,7 +526,7 @@ class MailHandlerTest < ActiveSupport::TestCase
|
|||||||
assert mail.subject.include?('Confirmation of email submission: Re: Add ingredients categories'), "Main subject missing"
|
assert mail.subject.include?('Confirmation of email submission: Re: Add ingredients categories'), "Main subject missing"
|
||||||
assert mail.body.include?("/issues/2"), "Link to issue missing"
|
assert mail.body.include?("/issues/2"), "Link to issue missing"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "#receive_message_reply" do
|
context "#receive_message_reply" do
|
||||||
|
@ -33,7 +33,7 @@ class MailerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
journal = Journal.find(2)
|
journal = Journal.find(2)
|
||||||
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
||||||
|
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_kind_of TMail::Mail, mail
|
assert_kind_of TMail::Mail, mail
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class MailerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
journal = Journal.find(2)
|
journal = Journal.find(2)
|
||||||
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
||||||
|
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_kind_of TMail::Mail, mail
|
assert_kind_of TMail::Mail, mail
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ class MailerTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
journal = Journal.find(2)
|
journal = Journal.find(2)
|
||||||
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
|
||||||
|
|
||||||
mail = ActionMailer::Base.deliveries.last
|
mail = ActionMailer::Base.deliveries.last
|
||||||
assert_kind_of TMail::Mail, mail
|
assert_kind_of TMail::Mail, mail
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ class MemberTest < ActiveSupport::TestCase
|
|||||||
@member_on_public_project.destroy
|
@member_on_public_project.destroy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "by updating roles" do
|
context "by updating roles" do
|
||||||
|
@ -96,7 +96,7 @@ class RepositoryTest < ActiveSupport::TestCase
|
|||||||
journal = fixed_issue.journals.last
|
journal = fixed_issue.journals.last
|
||||||
assert_equal User.find_by_login('dlopper'), journal.user
|
assert_equal User.find_by_login('dlopper'), journal.user
|
||||||
assert_equal 'Applied in changeset r2.', journal.notes
|
assert_equal 'Applied in changeset r2.', journal.notes
|
||||||
|
|
||||||
# 2 email notifications to 5 users
|
# 2 email notifications to 5 users
|
||||||
assert_equal 5, ActionMailer::Base.deliveries.size
|
assert_equal 5, ActionMailer::Base.deliveries.size
|
||||||
mail = ActionMailer::Base.deliveries.first
|
mail = ActionMailer::Base.deliveries.first
|
||||||
|
@ -129,26 +129,26 @@ class WatcherTest < ActiveSupport::TestCase
|
|||||||
@group.users << @user = User.find(1)
|
@group.users << @user = User.find(1)
|
||||||
@group.users << @user2 = User.find(2)
|
@group.users << @user2 = User.find(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "be valid" do
|
should "be valid" do
|
||||||
assert @issue.add_watcher(@group)
|
assert @issue.add_watcher(@group)
|
||||||
@issue.reload
|
@issue.reload
|
||||||
assert @issue.watchers.detect { |w| w.user == @group }
|
assert @issue.watchers.detect { |w| w.user == @group }
|
||||||
end
|
end
|
||||||
|
|
||||||
should "add all group members to recipients" do
|
should "add all group members to recipients" do
|
||||||
@issue.watchers.delete_all
|
@issue.watchers.delete_all
|
||||||
@issue.reload
|
@issue.reload
|
||||||
|
|
||||||
assert @issue.watcher_recipients.empty?
|
assert @issue.watcher_recipients.empty?
|
||||||
assert @issue.add_watcher(@group)
|
assert @issue.add_watcher(@group)
|
||||||
|
|
||||||
@user.save
|
@user.save
|
||||||
@issue.reload
|
@issue.reload
|
||||||
assert @issue.watcher_recipients.include?(@user.mail)
|
assert @issue.watcher_recipients.include?(@user.mail)
|
||||||
assert @issue.watcher_recipients.include?(@user2.mail)
|
assert @issue.watcher_recipients.include?(@user2.mail)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||||||
page = WikiPage.new(:wiki => @wiki, :title => "A new page")
|
page = WikiPage.new(:wiki => @wiki, :title => "A new page")
|
||||||
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
|
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
|
||||||
assert page.save
|
assert page.save
|
||||||
|
|
||||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||||||
content = @page.content
|
content = @page.content
|
||||||
content.text = "My new content"
|
content.text = "My new content"
|
||||||
assert content.save
|
assert content.save
|
||||||
|
|
||||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user