Fix trailing whitespace

This commit is contained in:
Holger Just 2012-01-18 19:26:03 +01:00
parent 19f2ccd496
commit 185edcd283
31 changed files with 114 additions and 114 deletions

View File

@ -55,7 +55,7 @@ class AutoCompletesController < ApplicationController
else
user_finder = User
end
@users = user_finder.active.like(params[:q]).find(:all, :limit => 100) - @removed_users
render :layout => false
end
@ -65,7 +65,7 @@ class AutoCompletesController < ApplicationController
@projects = Project.active.like(params[:q]).find(:all, :limit => 100) - @principal.projects
render :layout => false
end
private
def find_project

View File

@ -43,7 +43,7 @@ class DocumentsController < ApplicationController
end
def new
@document = @project.documents.build(params[:document])
@document = @project.documents.build(params[:document])
if request.post?
if User.current.allowed_to?(:add_document_watchers, @project) && params[:document]['watcher_user_ids'].present?
@document.watcher_user_ids = params[:document]['watcher_user_ids']

View File

@ -138,7 +138,7 @@ class GroupsController < ApplicationController
@membership = Member.edit_membership(params[:membership_id], params[:membership], @group)
@membership.save if request.post?
end
respond_to do |format|
if @membership.valid?
format.html { redirect_to :controller => 'groups', :action => 'edit', :id => @group, :tab => 'memberships' }

View File

@ -101,7 +101,7 @@ class JournalsController < ApplicationController
render_404
end
end
private
def find_journal

View File

@ -17,7 +17,7 @@ class WatchersController < ApplicationController
before_filter :require_login, :check_project_privacy, :only => [:watch, :unwatch]
before_filter :authorize, :only => [:new, :destroy]
before_filter :authorize_access_to_object, :only => [:new, :destroy]
verify :method => :post,
:only => [ :watch, :unwatch ],
:render => { :nothing => true, :status => :method_not_allowed }
@ -40,7 +40,7 @@ class WatchersController < ApplicationController
@watcher.watchable = @watched
@watcher.save if request.post?
end if params[:user_ids].present?
respond_to do |format|
format.html { redirect_to :back }
format.js do
@ -117,5 +117,5 @@ private
deny_access
end
end
end

View File

@ -26,7 +26,7 @@ class Group < Principal
def mails
users.collect(&:mail)
end
def to_s
lastname.to_s
end

View File

@ -302,7 +302,7 @@ class Mailer < ActionMailer::Base
project = ''
url = ''
end
subject "[#{project}] #{l(:label_mail_handler_confirmation, :subject => email_subject)}"
body(:object => object,
:url => url)
@ -315,7 +315,7 @@ class Mailer < ActionMailer::Base
body({})
render_multipart('mail_handler_unauthorized_action', body)
end
def mail_handler_missing_information(user, email_subject, error_message)
recipients user.mail
subject l(:label_mail_handler_failure, :subject => email_subject)

View File

@ -123,7 +123,7 @@ class Principal < ActiveRecord::Base
end
roles
end
protected
# Make sure we don't try to insert NULL values (see #4632)

View File

@ -82,7 +82,7 @@ class Project < ActiveRecord::Base
named_scope :active, { :conditions => "#{Project.table_name}.status = #{STATUS_ACTIVE}"}
named_scope :all_public, { :conditions => { :is_public => true } }
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}%"
{
:conditions => ["LOWER(name) LIKE ?", s]

View File

@ -221,7 +221,7 @@ class Query < ActiveRecord::Base
def has_filter?(field)
filters and filters[field]
end
def type_for(field)
available_filters[field][:type] if available_filters.has_key?(field)
end
@ -647,7 +647,7 @@ class Query < ActiveRecord::Base
@available_filters["cf_#{field.id}"] = options.merge({ :name => field.name })
end
end
# Returns a SQL clause for a date or datetime field.
def date_clause(table, field, from, to)
s = []
@ -659,7 +659,7 @@ class Query < ActiveRecord::Base
end
s.join(' AND ')
end
# Returns a SQL clause for a date or datetime field using relative dates.
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))

View File

@ -15,7 +15,7 @@
class Watcher < ActiveRecord::Base
belongs_to :watchable, :polymorphic => true
belongs_to :user, :class_name => 'Principal', :foreign_key => 'user_id'
validates_presence_of :user
validates_uniqueness_of :user_id, :scope => [:watchable_type, :watchable_id]

View File

@ -8,7 +8,7 @@
:url => { :controller => 'auto_completes', :action => 'projects', :id => principal },
:with => 'q')
%>
<div id="projects">
<%= principals_check_box_tags 'project_ids[]', projects %>
</div>

View File

@ -5,7 +5,7 @@
<h3><%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)</h3>
<% 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',
:action => 'new',
: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),
:with => 'q')
%>
<div id="users">
<%= principals_check_box_tags 'user_ids[]', users %>
</div>

View File

@ -950,7 +950,7 @@ en:
text_display_subprojects: Display subprojects
text_current_project: Current project
text_mail_handler_confirmation_successful: "Your email has been successful added at the following url"
default_role_manager: Manager
default_role_developer: Developer
default_role_reporter: Reporter

View File

@ -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.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.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 :calendar, :path_prefix => '/issues', :controller => 'calendars', :only => [:show, :update]

View File

@ -1,23 +1,23 @@
Return-Path: <JSmith@somenet.foo>
Received: from osiris ([127.0.0.1])
by OSIRIS
with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
From: "John Smith" <JSmith@somenet.foo>
To: <redmine@somenet.foo>
Subject: New ticket on a given project
Date: Sun, 22 Jun 2008 12:28:07 +0200
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Test with missing information
Project: onlinestore
Return-Path: <JSmith@somenet.foo>
Received: from osiris ([127.0.0.1])
by OSIRIS
with hMailServer ; Sun, 22 Jun 2008 12:28:07 +0200
Message-ID: <000501c8d452$a95cd7e0$0a00a8c0@osiris>
From: "John Smith" <JSmith@somenet.foo>
To: <redmine@somenet.foo>
Subject: New ticket on a given project
Date: Sun, 22 Jun 2008 12:28:07 +0200
MIME-Version: 1.0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2900.2869
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869
Test with missing information
Project: onlinestore

View File

@ -77,16 +77,16 @@ class AutoCompletesControllerTest < ActionController::TestCase
setup do
get :users, :q => 'complete'
end
should_respond_with :success
should "render a list of matching users in checkboxes" do
assert_select "input[type=checkbox][value=?]", @login.id
assert_select "input[type=checkbox][value=?]", @firstname.id
assert_select "input[type=checkbox][value=?]", @lastname.id
assert_select "input[type=checkbox][value=?]", @none.id, :count => 0
end
should "only show active users" do
assert_select "input[type=checkbox][value=?]", @inactive.id, :count => 0
end
@ -97,9 +97,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
@group = Group.generate(:lastname => 'Complete Group').reload
get :users, :q => 'complete', :include_groups => true
end
should_respond_with :success
should "include matching groups" do
assert_select "input[type=checkbox][value=?]", @group.id
end
@ -113,9 +113,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
@group.users << @firstname
get :users, :q => 'complete', :remove_group_members => @group.id
end
should_respond_with :success
should "not include existing members of the Group" do
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
end
end
context "restrict by removing issue watchers" do
setup do
@issue = Issue.find(2)
@ -131,9 +131,9 @@ class AutoCompletesControllerTest < ActionController::TestCase
@issue.add_watcher(@firstname)
get :users, :q => 'complete', :remove_watchers => @issue.id, :klass => 'Issue'
end
should_respond_with :success
should "not include existing watchers" do
assert_select "input[type=checkbox][value=?]", @lastname.id
@ -156,7 +156,7 @@ class AutoCompletesControllerTest < ActionController::TestCase
assert_response 403
end
context 'with a valid search' do
setup do
@user = User.generate_with_protected!
@ -165,15 +165,15 @@ class AutoCompletesControllerTest < ActionController::TestCase
Project.generate!(:name => "This is a Test")
]
Project.generate!(:name => "No match")
@request.session[:user_id] = 1
post :projects, {
:id => @user.id,
:q => 'TeST'
}
end
should_assign_to(:principal) { @user }
should_assign_to(:projects) { @projects }
should_render_template :projects
@ -183,18 +183,18 @@ class AutoCompletesControllerTest < ActionController::TestCase
setup do
@user = User.generate_with_protected!
Project.generate!(:name => "Test")
@request.session[:user_id] = 1
post :projects, {
:id => @user.id,
:q => 'nothing'
}
end
should_assign_to(:principal) { @user }
should_assign_to(:projects) { [] }
should_render_template :projects
end
end
end

View File

@ -87,7 +87,7 @@ LOREM
should "allow adding watchers" do
@request.session[:user_id] = 2
set_tmp_attachments_directory
post(:new,
:project_id => 'ecookbook',
:document => {
@ -99,14 +99,14 @@ LOREM
:attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain')}})
assert_redirected_to '/projects/ecookbook/documents'
document = Document.find_by_title('DocumentsControllerTest#test_post_new')
assert_not_nil document
assert document.watched_by?(User.find(2))
assert document.watched_by?(User.find(3))
end
end
context "POST #edit" do
setup do
@request.session[:user_id] = 2
@ -115,7 +115,7 @@ LOREM
@document = Document.generate!(:project => Project.find('ecookbook'),
:title => 'Test')
end
should "update the document" do
post(:edit,
:id => @document.id,
@ -129,7 +129,7 @@ LOREM
assert_not_nil @document
assert_equal 'Change', @document.title
end
should "allow adding watchers" do
post(:edit,
:id => @document.id,
@ -146,7 +146,7 @@ LOREM
assert @document.watched_by?(User.find(3))
end
end
def test_destroy
@request.session[:user_id] = 2
post :destroy, :id => 1

View File

@ -566,7 +566,7 @@ class IssuesControllerTest < ActionController::TestCase
:custom_field_values => {'2' => 'Value for field 2'}}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
assert_equal 2, ActionMailer::Base.deliveries.size
end

View File

@ -87,14 +87,14 @@ class JournalsControllerTest < ActionController::TestCase
@issue = Issue.find(6)
@previous_description = @issue.description
@new_description = "New description"
assert_difference("Journal.count") do
@issue.description = @new_description
assert @issue.save
end
@last_journal = @issue.last_journal
end
context "without a valid journal" do
should "return a 404" do
get :diff, :id => '0'
@ -124,14 +124,14 @@ class JournalsControllerTest < ActionController::TestCase
assert_response :forbidden
end
end
context "with permission to view_issues" do
setup do
get :diff, :id => @last_journal.id, :field => 'description'
end
should "create a diff" do
assert_not_nil assigns(:diff)
assert assigns(:diff).is_a?(Redmine::Helpers::Diff)
@ -140,9 +140,9 @@ class JournalsControllerTest < ActionController::TestCase
should "render an inline diff" do
assert_select "#content .text-diff"
end
end
end
end

View File

@ -308,7 +308,7 @@ class UsersControllerTest < ActionController::TestCase
post :edit_membership, :id => 2, :project_ids => [3,6], :membership => { :role_ids => ['1', '2']}
end
end
def test_destroy_membership
post :destroy_membership, :id => 2, :membership_id => 1
assert_redirected_to :action => 'edit', :id => '2', :tab => 'memberships'

View File

@ -148,7 +148,7 @@ class WatchersControllerTest < ActionController::TestCase
end
end
def test_new_multiple_users_watching_wiki_page
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(4))
assert !@page.watched_by?(User.find(7))
assert_difference('Watcher.count', 3) do
xhr :post, :new, :object_type => 'wiki_page', :object_id => '1', :user_ids => ['2','4','7']
assert_response :success
@ -168,7 +168,7 @@ class WatchersControllerTest < ActionController::TestCase
assert @page.watched_by?(User.find(4))
assert @page.watched_by?(User.find(7))
end
def test_new_multiple_users_watching_board
Role.find(1).add_permission! :add_board_watchers
@ -177,7 +177,7 @@ class WatchersControllerTest < ActionController::TestCase
@board = Board.generate!(:project => @project)
assert !@board.watched_by?(User.find(2))
assert !@board.watched_by?(User.find(4))
assert_difference('Watcher.count', 2) do
xhr :post, :new, :object_type => 'board', :object_id => @board.id, :user_ids => ['2','4']
assert_response :success
@ -197,7 +197,7 @@ class WatchersControllerTest < ActionController::TestCase
@message = Message.generate!(:board => @board)
assert !@message.watched_by?(User.find(2))
assert !@message.watched_by?(User.find(4))
assert_difference('Watcher.count', 2) do
xhr :post, :new, :object_type => 'message', :object_id => @message.id, :user_ids => ['2','4']
assert_response :success
@ -219,7 +219,7 @@ class WatchersControllerTest < ActionController::TestCase
assert !Issue.find(2).watched_by?(User.find(4))
end
def test_new_wiki_page_watcher_without_permission
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))
end
def test_new_board_watcher_without_permission
Role.find(1).remove_permission! :add_board_watchers
@ -267,7 +267,7 @@ class WatchersControllerTest < ActionController::TestCase
def test_remove_watcher
Role.find(1).add_permission! :delete_issue_watchers
@request.session[:user_id] = 2
assert_difference('Watcher.count', -1) do
xhr :post, :destroy, :object_type => 'issue', :object_id => '2', :user_id => '3'
@ -292,9 +292,9 @@ class WatchersControllerTest < ActionController::TestCase
end
assert !Issue.find(2).watched_by?(@group)
end
end
def test_remove_wiki_page_watcher
Role.find(1).add_permission! :delete_wiki_page_watchers
@ -302,7 +302,7 @@ class WatchersControllerTest < ActionController::TestCase
@page = WikiPage.find(1)
Watcher.create!(:user_id => 2, :watchable => @page)
assert @page.watched_by?(User.find(2))
assert_difference('Watcher.count', -1) do
xhr :post, :destroy, :object_type => 'wiki_page', :object_id => '1', :user_id => '2'
assert_response :success
@ -355,7 +355,7 @@ class WatchersControllerTest < ActionController::TestCase
assert Issue.find(2).watched_by?(User.find(3))
end
def test_remove_wiki_page_watcher_without_permission
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))
end
def test_remove_board_watcher_without_permission
Role.find(1).remove_permission! :delete_board_watchers
@project = Project.find(1)
@ -394,7 +394,7 @@ class WatchersControllerTest < ActionController::TestCase
@message = Message.generate!(:board => @board)
Watcher.create!(:user_id => 2, :watchable => @message)
assert @message.watched_by?(User.find(2))
@request.session[:user_id] = 2
assert_difference('Watcher.count', 0) do
xhr :post, :destroy, :object_type => 'message', :object_id => @message.id, :user_id => '2'

View File

@ -19,7 +19,7 @@ class JournalsTest < ActionController::IntegrationTest
include IntegrationTestHelpers::CapybaraHelpers
include Capybara::DSL
test "showing issue description changes as a diff" do
# Description change
@issue = Issue.find(1)
@ -30,7 +30,7 @@ class JournalsTest < ActionController::IntegrationTest
@issue.description = "A new description"
assert @issue.save
end
log_user('jsmith', 'jsmith')
# Issue page

View File

@ -112,7 +112,7 @@ class RoutingTest < ActionController::IntegrationTest
context "journals" do
should_route :get, "/journals/100/diff/description", :controller => 'journals', :action => 'diff', :id => '100', :field => 'description'
end
context "issue categories" do
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
should_route :get, "/users/auto_complete", :controller => 'auto_completes', :action => 'users'
end
end

View File

@ -68,5 +68,5 @@ class DocumentTest < ActiveSupport::TestCase
assert document.recipients.include?(user.mail), "Watcher not included in recipients"
end
end
end

View File

@ -438,7 +438,7 @@ class MailHandlerTest < ActiveSupport::TestCase
ActionMailer::Base.deliveries.clear
issue = submit_email('ticket_by_unknown_user.eml')
assert_equal false, issue
assert_equal 1, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@ -455,7 +455,7 @@ class MailHandlerTest < ActiveSupport::TestCase
assert_no_difference('Journal.count') do
assert_equal false, submit_email('ticket_reply.eml')
end
assert_equal 1, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@ -470,7 +470,7 @@ class MailHandlerTest < ActiveSupport::TestCase
ActionMailer::Base.deliveries.clear
issue = submit_email('ticket_with_attachment.eml') # No project set
assert_equal false, issue
assert_equal 1, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@ -490,7 +490,7 @@ class MailHandlerTest < ActiveSupport::TestCase
ActionMailer::Base.deliveries.clear
issue = submit_email('ticket_on_project_with_missing_information.eml')
assert_equal false, issue
assert_equal 1, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
assert_not_nil mail
@ -505,7 +505,7 @@ class MailHandlerTest < ActiveSupport::TestCase
should "deliver an email confirmation when configured" do
ActionMailer::Base.deliveries.clear
issue = submit_email('ticket_on_given_project.eml')
assert_equal 2, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.last
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.body.include?("/issues/2"), "Link to issue missing"
end
end
context "#receive_message_reply" do

View File

@ -33,7 +33,7 @@ class MailerTest < ActiveSupport::TestCase
journal = Journal.find(2)
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
mail = ActionMailer::Base.deliveries.last
assert_kind_of TMail::Mail, mail
@ -55,7 +55,7 @@ class MailerTest < ActiveSupport::TestCase
journal = Journal.find(2)
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
mail = ActionMailer::Base.deliveries.last
assert_kind_of TMail::Mail, mail
@ -80,7 +80,7 @@ class MailerTest < ActiveSupport::TestCase
journal = Journal.find(2)
assert Mailer.deliver_issue_edit(journal,'dlopper@somenet.foo')
mail = ActionMailer::Base.deliveries.last
assert_kind_of TMail::Mail, mail

View File

@ -97,7 +97,7 @@ class MemberTest < ActiveSupport::TestCase
@member_on_public_project.destroy
end
end
end
context "by updating roles" do

View File

@ -96,7 +96,7 @@ class RepositoryTest < ActiveSupport::TestCase
journal = fixed_issue.journals.last
assert_equal User.find_by_login('dlopper'), journal.user
assert_equal 'Applied in changeset r2.', journal.notes
# 2 email notifications to 5 users
assert_equal 5, ActionMailer::Base.deliveries.size
mail = ActionMailer::Base.deliveries.first

View File

@ -129,26 +129,26 @@ class WatcherTest < ActiveSupport::TestCase
@group.users << @user = User.find(1)
@group.users << @user2 = User.find(2)
end
should "be valid" do
assert @issue.add_watcher(@group)
@issue.reload
assert @issue.watchers.detect { |w| w.user == @group }
end
should "add all group members to recipients" do
@issue.watchers.delete_all
@issue.reload
assert @issue.watcher_recipients.empty?
assert @issue.add_watcher(@group)
@user.save
@user.save
@issue.reload
assert @issue.watcher_recipients.include?(@user.mail)
assert @issue.watcher_recipients.include?(@user2.mail)
end
end
end

View File

@ -43,7 +43,7 @@ class WikiContentTest < ActiveSupport::TestCase
page = WikiPage.new(:wiki => @wiki, :title => "A new page")
page.content = WikiContent.new(:text => "Content text", :author => User.find(1), :comments => "My comment")
assert page.save
assert_equal 2, ActionMailer::Base.deliveries.size
end
@ -63,7 +63,7 @@ class WikiContentTest < ActiveSupport::TestCase
content = @page.content
content.text = "My new content"
assert content.save
assert_equal 2, ActionMailer::Base.deliveries.size
end