Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
185edcd2
Commit
185edcd2
authored
Jan 18, 2012
by
Holger Just
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix trailing whitespace
parent
19f2ccd4
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
114 additions
and
114 deletions
+114
-114
auto_completes_controller.rb
app/controllers/auto_completes_controller.rb
+2
-2
documents_controller.rb
app/controllers/documents_controller.rb
+1
-1
groups_controller.rb
app/controllers/groups_controller.rb
+1
-1
journals_controller.rb
app/controllers/journals_controller.rb
+1
-1
watchers_controller.rb
app/controllers/watchers_controller.rb
+3
-3
group.rb
app/models/group.rb
+1
-1
mailer.rb
app/models/mailer.rb
+2
-2
principal.rb
app/models/principal.rb
+1
-1
project.rb
app/models/project.rb
+1
-1
query.rb
app/models/query.rb
+3
-3
watcher.rb
app/models/watcher.rb
+1
-1
_membership_assignment.html.erb
app/views/members/_membership_assignment.html.erb
+1
-1
_watchers.rhtml
app/views/watchers/_watchers.rhtml
+2
-2
en.yml
config/locales/en.yml
+1
-1
routes.rb
config/routes.rb
+1
-1
ticket_on_project_with_missing_information.eml
...il_handler/ticket_on_project_with_missing_information.eml
+23
-23
auto_completes_controller_test.rb
test/functional/auto_completes_controller_test.rb
+17
-17
documents_controller_test.rb
test/functional/documents_controller_test.rb
+6
-6
issues_controller_test.rb
test/functional/issues_controller_test.rb
+1
-1
journals_controller_test.rb
test/functional/journals_controller_test.rb
+7
-7
users_controller_test.rb
test/functional/users_controller_test.rb
+1
-1
watchers_controller_test.rb
test/functional/watchers_controller_test.rb
+14
-14
journals_test.rb
test/integration/journals_test.rb
+2
-2
routing_test.rb
test/integration/routing_test.rb
+2
-2
document_test.rb
test/unit/document_test.rb
+1
-1
mail_handler_test.rb
test/unit/mail_handler_test.rb
+6
-6
mailer_test.rb
test/unit/mailer_test.rb
+3
-3
member_test.rb
test/unit/member_test.rb
+1
-1
repository_test.rb
test/unit/repository_test.rb
+1
-1
watcher_test.rb
test/unit/watcher_test.rb
+5
-5
wiki_content_test.rb
test/unit/wiki_content_test.rb
+2
-2
No files found.
app/controllers/auto_completes_controller.rb
View file @
185edcd2
...
...
@@ -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
...
...
app/controllers/documents_controller.rb
View file @
185edcd2
...
...
@@ -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'
]
...
...
app/controllers/groups_controller.rb
View file @
185edcd2
...
...
@@ -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'
}
...
...
app/controllers/journals_controller.rb
View file @
185edcd2
...
...
@@ -101,7 +101,7 @@ class JournalsController < ApplicationController
render_404
end
end
private
def
find_journal
...
...
app/controllers/watchers_controller.rb
View file @
185edcd2
...
...
@@ -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
app/models/group.rb
View file @
185edcd2
...
...
@@ -26,7 +26,7 @@ class Group < Principal
def
mails
users
.
collect
(
&
:mail
)
end
def
to_s
lastname
.
to_s
end
...
...
app/models/mailer.rb
View file @
185edcd2
...
...
@@ -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
)
...
...
app/models/principal.rb
View file @
185edcd2
...
...
@@ -123,7 +123,7 @@ class Principal < ActiveRecord::Base
end
roles
end
protected
# Make sure we don't try to insert NULL values (see #4632)
...
...
app/models/project.rb
View file @
185edcd2
...
...
@@ -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
]
...
...
app/models/query.rb
View file @
185edcd2
...
...
@@ -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
))
...
...
app/models/watcher.rb
View file @
185edcd2
...
...
@@ -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
]
...
...
app/views/members/_membership_assignment.html.erb
View file @
185edcd2
...
...
@@ -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>
...
...
app/views/watchers/_watchers.rhtml
View file @
185edcd2
...
...
@@ -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>
...
...
config/locales/en.yml
View file @
185edcd2
...
...
@@ -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
...
...
config/routes.rb
View file @
185edcd2
...
...
@@ -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
]
...
...
test/fixtures/mail_handler/ticket_on_project_with_missing_information.eml
View file @
185edcd2
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
test/functional/auto_completes_controller_test.rb
View file @
185edcd2
...
...
@@ -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
test/functional/documents_controller_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/functional/issues_controller_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/functional/journals_controller_test.rb
View file @
185edcd2
...
...
@@ -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
test/functional/users_controller_test.rb
View file @
185edcd2
...
...
@@ -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'
...
...
test/functional/watchers_controller_test.rb
View file @
185edcd2
...
...
@@ -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'
...
...
test/integration/journals_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/integration/routing_test.rb
View file @
185edcd2
...
...
@@ -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
test/unit/document_test.rb
View file @
185edcd2
...
...
@@ -68,5 +68,5 @@ class DocumentTest < ActiveSupport::TestCase
assert
document
.
recipients
.
include?
(
user
.
mail
),
"Watcher not included in recipients"
end
end
end
test/unit/mail_handler_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/unit/mailer_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/unit/member_test.rb
View file @
185edcd2
...
...
@@ -97,7 +97,7 @@ class MemberTest < ActiveSupport::TestCase
@member_on_public_project
.
destroy
end
end
end
context
"by updating roles"
do
...
...
test/unit/repository_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
test/unit/watcher_test.rb
View file @
185edcd2
...
...
@@ -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
test/unit/wiki_content_test.rb
View file @
185edcd2
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment