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
1f9eda4e
Commit
1f9eda4e
authored
Aug 05, 2010
by
Tim Felgentreff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests to work with the new data model, where neccessary
parent
81e97d23
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
644 additions
and
544 deletions
+644
-544
attachment.rb
app/models/attachment.rb
+17
-3
issue.rb
app/models/issue.rb
+9
-1
mail_handler.rb
app/models/mail_handler.rb
+28
-28
mailer.rb
app/models/mailer.rb
+1
-0
message.rb
app/models/message.rb
+2
-1
wiki_content.rb
app/models/wiki_content.rb
+2
-1
issue_edit.text.html.rhtml
app/views/mailer/issue_edit.text.html.rhtml
+1
-1
issue_edit.text.plain.rhtml
app/views/mailer/issue_edit.text.plain.rhtml
+1
-1
041_rename_comment_to_comments.rb
db/migrate/041_rename_comment_to_comments.rb
+1
-1
fetcher.rb
lib/redmine/activity/fetcher.rb
+6
-6
journal_details.yml
test/fixtures/journal_details.yml
+0
-22
journals.yml
test/fixtures/journals.yml
+172
-21
wiki_content_versions.yml
test/fixtures/wiki_content_versions.yml
+0
-56
wiki_contents.yml
test/fixtures/wiki_contents.yml
+25
-26
issues_controller_test.rb
test/functional/issues_controller_test.rb
+159
-155
issues_controller_transaction_test.rb
test/functional/issues_controller_transaction_test.rb
+1
-2
journals_controller_test.rb
test/functional/journals_controller_test.rb
+2
-2
projects_controller_test.rb
test/functional/projects_controller_test.rb
+1
-1
wiki_controller_test.rb
test/functional/wiki_controller_test.rb
+36
-36
issues_api_test.rb
test/integration/issues_api_test.rb
+0
-1
projects_api_test.rb
test/integration/projects_api_test.rb
+1
-1
test_helper.rb
test/test_helper.rb
+16
-20
activity_test.rb
test/unit/activity_test.rb
+16
-14
issue_test.rb
test/unit/issue_test.rb
+88
-87
journal_test.rb
test/unit/journal_test.rb
+7
-7
mail_handler_test.rb
test/unit/mail_handler_test.rb
+1
-1
mailer_test.rb
test/unit/mailer_test.rb
+2
-2
search_test.rb
test/unit/search_test.rb
+0
-1
wiki_content_test.rb
test/unit/wiki_content_test.rb
+14
-14
wiki_page_test.rb
test/unit/wiki_page_test.rb
+22
-19
wiki_test.rb
test/unit/wiki_test.rb
+10
-10
acts_as_activity_provider.rb
...cts_as_activity_provider/lib/acts_as_activity_provider.rb
+3
-3
No files found.
app/models/attachment.rb
View file @
1f9eda4e
...
...
@@ -19,6 +19,12 @@ require "digest/md5"
class
Attachment
<
ActiveRecord
::
Base
belongs_to
:container
,
:polymorphic
=>
true
# FIXME: Remove these once the Versions, Documents and Projects themselves can provide file events
belongs_to
:version
,
:foreign_key
=>
"container_id"
belongs_to
:document
,
:foreign_key
=>
"container_id"
belongs_to
:project
,
:foreign_key
=>
"container_id"
belongs_to
:author
,
:class_name
=>
"User"
,
:foreign_key
=>
"author_id"
validates_presence_of
:container
,
:filename
,
:author
...
...
@@ -31,16 +37,24 @@ class Attachment < ActiveRecord::Base
:id
=>
o
.
versioned_id
,
:filename
=>
o
.
filename
}
end
),
:activity_type
=>
'files'
,
:activity_permission
=>
:view_files
:activity_permission
=>
:view_files
,
:activity_find_options
=>
{
:include
=>
{
:version
=>
:project
}
}
acts_as_activity
:type
=>
'documents'
,
:permission
=>
:view_documents
acts_as_activity
:type
=>
'documents'
,
:permission
=>
:view_documents
,
:find_options
=>
{
:include
=>
{
:document
=>
:project
}
}
# This method is called on save by the AttachmentJournal in order to
# decide which kind of activity we are dealing with. When that activity
# is retrieved later, we don't need to check the container_type in
# SQL anymore as that will be just the one we have specified here.
def
activity_type
case
container_type
when
"Document"
"documents"
when
"Version"
"files"
when
"Project"
"files"
else
super
end
...
...
app/models/issue.rb
View file @
1f9eda4e
...
...
@@ -775,5 +775,13 @@ class Issue < ActiveRecord::Base
group by s.id, s.is_closed, j.id"
)
end
IssueJournal
.
class_eval
do
# Shortcut
def
new_status
if
details
.
keys
.
include?
'status_id'
(
newval
=
details
[
'status_id'
].
last
)
?
IssueStatus
.
find_by_id
(
newval
.
to_i
)
:
nil
end
end
end
end
app/models/mail_handler.rb
View file @
1f9eda4e
...
...
@@ -197,7 +197,7 @@ class MailHandler < ActionMailer::Base
# Reply will be added to the issue
def
receive_journal_reply
(
journal_id
)
journal
=
Journal
.
find_by_id
(
journal_id
)
if
journal
&&
journal
.
versioned
.
is_a?
Issue
if
journal
and
journal
.
versioned
.
is_a?
Issue
receive_issue_reply
(
journal
.
versioned_id
)
end
end
...
...
app/models/mailer.rb
View file @
1f9eda4e
...
...
@@ -19,6 +19,7 @@ class Mailer < ActionMailer::Base
layout
'mailer'
helper
:application
helper
:issues
helper
:journals
helper
:custom_fields
include
ActionController
::
UrlWriter
...
...
app/models/message.rb
View file @
1f9eda4e
...
...
@@ -31,7 +31,8 @@ class Message < ActiveRecord::Base
else
{
:id
=>
o
.
parent_id
,
:r
=>
o
.
id
,
:anchor
=>
"message-
#{
o
.
id
}
"
}
end
.
reverse_merge
:controller
=>
'messages'
,
:action
=>
'show'
,
:board_id
=>
o
.
board_id
end
)
end
),
:activity_find_options
=>
{
:include
=>
{
:board
=>
:project
}
}
acts_as_searchable
:columns
=>
[
'subject'
,
'content'
],
:include
=>
{
:board
=>
:project
},
...
...
app/models/wiki_content.rb
View file @
1f9eda4e
...
...
@@ -27,7 +27,8 @@ class WikiContent < ActiveRecord::Base
:event_title
=>
Proc
.
new
{
|
o
|
"
#{
l
(
:label_wiki_edit
)
}
:
#{
o
.
page
.
title
}
(#
#{
o
.
version
}
)"
},
:event_url
=>
Proc
.
new
{
|
o
|
{
:controller
=>
'wiki'
,
:id
=>
o
.
page
.
wiki
.
project_id
,
:page
=>
o
.
page
.
title
,
:version
=>
o
.
version
}},
:activity_type
=>
'wiki_edits'
,
:activity_permission
=>
:view_wiki_edits
:activity_permission
=>
:view_wiki_edits
,
:activity_find_options
=>
{
:include
=>
{
:page
=>
{
:wiki
=>
:project
}
}
}
def
activity_type
'wiki_edits'
...
...
app/views/mailer/issue_edit.text.html.rhtml
View file @
1f9eda4e
...
...
@@ -2,7 +2,7 @@
<ul>
<%
for
detail
in
@journal
.
details
%>
<li>
<%=
show
_detail
(
detail
,
true
)
%>
</li>
<li>
<%=
@journal
.
render
_detail
(
detail
,
true
)
%>
</li>
<%
end
%>
</ul>
...
...
app/views/mailer/issue_edit.text.plain.rhtml
View file @
1f9eda4e
<%=
l
(
:text_issue_updated
,
:id
=>
"#
#{
@issue
.
id
}
"
,
:author
=>
@journal
.
user
)
%>
<%
for
detail
in
@journal
.
details
-%>
<%=
show
_detail
(
detail
,
true
)
%>
<%=
@journal
.
render
_detail
(
detail
,
true
)
%>
<%
end
-%>
<%=
@journal
.
notes
if
@journal
.
notes?
%>
...
...
db/migrate/041_rename_comment_to_comments.rb
View file @
1f9eda4e
...
...
@@ -2,7 +2,7 @@ class RenameCommentToComments < ActiveRecord::Migration
def
self
.
up
rename_column
(
:comments
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
Comment
.
table_name
).
detect
{
|
c
|
c
.
name
==
"comment"
}
rename_column
(
:wiki_contents
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
WikiContent
.
table_name
).
detect
{
|
c
|
c
.
name
==
"comment"
}
rename_column
(
:wiki_content_versions
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
WikiContent
.
versioned_table_name
).
detect
{
|
c
|
c
.
name
==
"comment"
}
rename_column
(
:wiki_content_versions
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
"wiki_content_versions"
).
detect
{
|
c
|
c
.
name
==
"comment"
}
rename_column
(
:time_entries
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
TimeEntry
.
table_name
).
detect
{
|
c
|
c
.
name
==
"comment"
}
rename_column
(
:changesets
,
:comment
,
:comments
)
if
ActiveRecord
::
Base
.
connection
.
columns
(
Changeset
.
table_name
).
detect
{
|
c
|
c
.
name
==
"comment"
}
end
...
...
lib/redmine/activity/fetcher.rb
View file @
1f9eda4e
...
...
@@ -38,11 +38,11 @@ module Redmine
return
@event_types
unless
@event_types
.
nil?
@event_types
=
Redmine
::
Activity
.
available_event_types
if
@project
@event_types
=
@event_types
.
select
do
|
o
|
permissions
=
constantized_providers
(
o
).
collect
do
|
p
|
p
.
activity_provider_options
[
o
].
try
(
:[]
,
:permission
)
end
.
compact
if
@project
return
@user
.
allowed_to?
(
"view_
#{
o
}
"
.
to_sym
,
@project
)
if
permissions
.
blank?
permissions
.
all?
{
|
p
|
@user
.
allowed_to?
(
p
,
@project
)
}
if
@project
end
...
...
test/fixtures/journal_details.yml
deleted
100644 → 0
View file @
81e97d23
---
journal_details_001
:
old_value
:
"
1"
property
:
attr
id
:
1
value
:
"
2"
prop_key
:
status_id
journal_id
:
1
journal_details_002
:
old_value
:
"
40"
property
:
attr
id
:
2
value
:
"
30"
prop_key
:
done_ratio
journal_id
:
1
journal_details_003
:
old_value
:
nil
property
:
attr
id
:
3
value
:
"
6"
prop_key
:
fixed_version_id
journal_id
:
4
test/fixtures/journals.yml
View file @
1f9eda4e
---
journals_001
:
created_on
:
<%= 2.days.ago.to_date.to_s(:db) %>
notes
:
"
Journal
notes"
id
:
1
journalized_type
:
Issue
type
:
"
IssueJournal"
activity_type
:
"
issues"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
1
journalized_id
:
1
notes
:
"
Journal
notes"
versioned_id
:
1
changes
:
|
---
status_id:
- 1
- 2
done_ratio:
- 40
- 30
journals_002
:
created_on
:
<%= 1.days.ago.to_date.to_s(:db) %>
notes
:
"
Some
notes
with
Redmine
links:
#2,
r2."
id
:
2
journalized_type
:
Issue
type
:
"
IssueJournal"
activity_type
:
"
issues"
created_at
:
<%= 1.days.ago.to_date.to_s(:db) %>
version
:
2
user_id
:
2
journalized_id
:
1
notes
:
"
Some
notes
with
Redmine
links:
#2,
r2."
versioned_id
:
1
changes
:
"
---
{}"
journals_003
:
created_on
:
<%= 1.days.ago.to_date.to_s(:db) %>
notes
:
"
A
comment
with
inline
image:
!picture.jpg!"
id
:
3
journalized_type
:
Issue
type
:
"
IssueJournal"
activity_type
:
"
issues"
created_at
:
<%= 1.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
journalized_id
:
2
notes
:
"
A
comment
with
inline
image:
!picture.jpg!"
versioned_id
:
2
changes
:
"
---
{}"
journals_004
:
created_on
:
<%= 1.days.ago.to_date.to_s(:db) %>
notes
:
"
A
comment
with
a
private
version."
id
:
4
journalized_type
:
Issue
type
:
"
IssueJournal"
activity_type
:
"
issues"
created_at
:
<%= 1.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
notes
:
"
A
comment
with
a
private
version."
versioned_id
:
6
changes
:
|
---
fixed_version_id:
-
- 6
journals_005
:
id
:
5
type
:
"
IssueJournal"
activity_type
:
"
issues"
created_at
:
<%= 1.days.ago.to_date.to_s(:db) %>
version
:
0
user_id
:
1
journalized_id
:
6
notes
:
versioned_id
:
5
changes
:
"
---
{}"
journals_006
:
id
:
6
type
:
"
WikiContentJournal"
activity_type
:
"
wiki_edits"
created_at
:
2007-03-07 00:08:07 +01:00
version
:
1
user_id
:
2
notes
:
Page creation
versioned_id
:
1
changes
:
|
---
compression: ""
data: |-
h1. CookBook documentation
Some [[documentation]] here...
journals_007
:
id
:
7
type
:
"
WikiContentJournal"
activity_type
:
"
wiki_edits"
created_at
:
2007-03-07 00:08:34 +01:00
version
:
2
user_id
:
1
notes
:
Small update
versioned_id
:
1
changes
:
|
---
compression: ""
data: |-
h1. CookBook documentation
Some updated [[documentation]] here...
journals_008
:
id
:
8
type
:
"
WikiContentJournal"
activity_type
:
"
wiki_edits"
created_at
:
2007-03-07 00:10:51 +01:00
version
:
3
user_id
:
1
notes
:
"
"
versioned_id
:
1
changes
:
|
---
compression: ""
data: |-
h1. CookBook documentation
Some updated [[documentation]] here...
journals_009
:
id
:
9
type
:
"
WikiContentJournal"
activity_type
:
"
wiki_edits"
created_at
:
2007-03-08 00:18:07 +01:00
version
:
1
user_id
:
1
notes
:
versioned_id
:
2
changes
:
|
---
data: |-
h1. Another page
This is a link to a ticket: #2
journals_010
:
id
:
10
type
:
"
MessageJournal"
activity_type
:
"
messages"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
1
notes
:
versioned_id
:
5
changes
:
--- {}
journals_011
:
id
:
11
type
:
"
AttachmentJournal"
activity_type
:
"
files"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
notes
:
"
An
attachment
on
a
version"
versioned_id
:
9
changes
:
--- {}
journals_012
:
id
:
12
type
:
"
AttachmentJournal"
activity_type
:
"
files"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
notes
:
"
An
attachment
on
a
project"
versioned_id
:
8
changes
:
--- {}
journals_013
:
id
:
13
type
:
"
AttachmentJournal"
activity_type
:
"
files"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
notes
:
"
An
attachment
on
an
issue"
versioned_id
:
7
changes
:
--- {}
journals_014
:
id
:
14
type
:
"
AttachmentJournal"
activity_type
:
"
documents"
created_at
:
<%= 2.days.ago.to_date.to_s(:db) %>
version
:
1
user_id
:
2
notes
:
"
An
attachment
on
a
document"
versioned_id
:
2
changes
:
--- {}
\ No newline at end of file
test/fixtures/wiki_content_versions.yml
deleted
100644 → 0
View file @
81e97d23
---
wiki_content_versions_001
:
updated_on
:
2007-03-07 00:08:07 +01:00
page_id
:
1
id
:
1
version
:
1
author_id
:
2
comments
:
Page creation
wiki_content_id
:
1
compression
:
"
"
data
:
|-
h1. CookBook documentation
Some [[documentation]] here...
wiki_content_versions_002
:
updated_on
:
2007-03-07 00:08:34 +01:00
page_id
:
1
id
:
2
version
:
2
author_id
:
1
comments
:
Small update
wiki_content_id
:
1
compression
:
"
"
data
:
|-
h1. CookBook documentation
Some updated [[documentation]] here...
wiki_content_versions_003
:
updated_on
:
2007-03-07 00:10:51 +01:00
page_id
:
1
id
:
3
version
:
3
author_id
:
1
comments
:
"
"
wiki_content_id
:
1
compression
:
"
"
data
:
|-
h1. CookBook documentation
Some updated [[documentation]] here...
wiki_content_versions_004
:
data
:
|-
h1. Another page
This is a link to a ticket: #2
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 2
wiki_content_id: 2
id: 4
version: 1
author_id: 1
comments:
test/fixtures/wiki_contents.yml
View file @
1f9eda4e
...
...
@@ -9,7 +9,7 @@ wiki_contents_001:
updated_on: 2007-03-07 00:10:51 +01:00
page_id: 1
id: 1
version: 3
lock_
version: 3
author_id: 1
comments: Gzip compression activated
wiki_contents_002
:
...
...
@@ -22,7 +22,7 @@ wiki_contents_002:
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 2
id: 2
version: 1
lock_
version: 1
author_id: 1
comments:
wiki_contents_003
:
...
...
@@ -33,7 +33,7 @@ wiki_contents_003:
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 3
id: 3
version: 1
lock_
version: 1
author_id: 1
comments:
wiki_contents_004
:
...
...
@@ -46,7 +46,7 @@ wiki_contents_004:
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 4
id: 4
version: 1
lock_
version: 1
author_id: 1
comments:
wiki_contents_005
:
...
...
@@ -57,7 +57,7 @@ wiki_contents_005:
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 5
id: 5
version: 1
lock_
version: 1
author_id: 1
comments:
wiki_contents_006
:
...
...
@@ -68,7 +68,7 @@ wiki_contents_006:
updated_on: 2007-03-08 00:18:07 +01:00
page_id: 6
id: 6
version: 1
lock_
version: 1
author_id: 1
comments:
wiki_contents_007
:
...
...
@@ -76,7 +76,7 @@ wiki_contents_007:
updated_on
:
2007-03-08 00:18:07 +01:00
page_id
:
7
id
:
7
version
:
1
lock_
version
:
1
author_id
:
1
comments
:
wiki_contents_008
:
...
...
@@ -84,7 +84,7 @@ wiki_contents_008:
updated_on
:
2007-03-08 00:18:07 +01:00
page_id
:
8
id
:
8
version
:
1
lock_
version
:
1
author_id
:
1
comments
:
wiki_contents_009
:
...
...
@@ -92,7 +92,6 @@ wiki_contents_009:
updated_on
:
2007-03-08 00:18:07 +01:00
page_id
:
9
id
:
9
version
:
1
lock_
version
:
1
author_id
:
1
comments
:
\ No newline at end of file
test/functional/issues_controller_test.rb
View file @
1f9eda4e
...
...
@@ -43,7 +43,6 @@ class IssuesControllerTest < ActionController::TestCase
:custom_fields_trackers
,
:time_entries
,
:journals
,
:journal_details
,
:queries
def
setup
...
...
@@ -671,14 +670,16 @@ class IssuesControllerTest < ActionController::TestCase
old_subject
=
issue
.
subject
new_subject
=
'Subject modified by IssuesControllerTest#test_post_edit'
assert_difference
(
'Journal.count'
)
do
assert_difference
(
'JournalDetail.count'
,
2
)
do
assert_difference
(
'IssueJournal.count'
)
do
put
:update
,
:id
=>
1
,
:issue
=>
{
:subject
=>
new_subject
,
:priority_id
=>
'6'
,
:category_id
=>
'1'
# no change
}
end
end
assert
Issue
.
current_journal
.
changes
.
has_key?
"subject"
assert
Issue
.
current_journal
.
changes
.
has_key?
"priority_id"
assert
!
Issue
.
current_journal
.
changes
.
has_key?
"category_id"
assert_redirected_to
:action
=>
'show'
,
:id
=>
'1'
issue
.
reload
assert_equal
new_subject
,
issue
.
subject
...
...
@@ -697,14 +698,17 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal
'125'
,
issue
.
custom_value_for
(
2
).
value
assert_difference
(
'Journal.count'
)
do
assert_difference
(
'JournalDetail.count'
,
3
)
do
put
:update
,
:id
=>
1
,
:issue
=>
{
:subject
=>
'Custom field change'
,
:priority_id
=>
'6'
,
:category_id
=>
'1'
,
# no change
:custom_field_values
=>
{
'2'
=>
'New custom value'
}
}
end
end
assert
Issue
.
current_journal
.
changes
.
has_key?
"subject"
assert
Issue
.
current_journal
.
changes
.
has_key?
"priority_id"
assert
!
Issue
.
current_journal
.
changes
.
has_key?
"category_id"
assert
Issue
.
current_journal
.
changes
.
has_key?
"2"
assert_redirected_to
:action
=>
'show'
,
:id
=>
'1'
issue
.
reload
assert_equal
'New custom value'
,
issue
.
custom_value_for
(
2
).
value
...
...
test/functional/issues_controller_transaction_test.rb
View file @
1f9eda4e
...
...
@@ -43,7 +43,6 @@ class IssuesControllerTransactionTest < ActionController::TestCase
:custom_fields_trackers
,
:time_entries
,
:journals
,
:journal_details
,
:queries
self
.
use_transactional_fixtures
=
false
...
...
test/functional/journals_controller_test.rb
View file @
1f9eda4e
...
...
@@ -22,7 +22,7 @@ require 'journals_controller'
class
JournalsController
;
def
rescue_action
(
e
)
raise
e
end
;
end
class
JournalsControllerTest
<
ActionController
::
TestCase
fixtures
:projects
,
:users
,
:members
,
:member_roles
,
:roles
,
:issues
,
:journals
,
:
journal_details
,
:
enabled_modules
fixtures
:projects
,
:users
,
:members
,
:member_roles
,
:roles
,
:issues
,
:journals
,
:enabled_modules
def
setup
@controller
=
JournalsController
.
new
...
...
test/functional/projects_controller_test.rb
View file @
1f9eda4e
...
...
@@ -22,7 +22,7 @@ require 'projects_controller'
class
ProjectsController
;
def
rescue_action
(
e
)
raise
e
end
;
end
class
ProjectsControllerTest
<
ActionController
::
TestCase
fixtures
:projects
,
:versions
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:journal_details
,
fixtures
:projects
,
:versions
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:trackers
,
:projects_trackers
,
:issue_statuses
,
:enabled_modules
,
:enumerations
,
:boards
,
:messages
,
:attachments
,
:custom_fields
,
:custom_values
,
:time_entries
...
...
test/functional/wiki_controller_test.rb
View file @
1f9eda4e
...
...
@@ -22,7 +22,7 @@ require 'wiki_controller'
class
WikiController
;
def
rescue_action
(
e
)
raise
e
end
;
end
class
WikiControllerTest
<
ActionController
::
TestCase
fixtures
:projects
,
:users
,
:roles
,
:members
,
:member_roles
,
:enabled_modules
,
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
wiki_content_version
s
,
:attachments
fixtures
:projects
,
:users
,
:roles
,
:members
,
:member_roles
,
:enabled_modules
,
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
journal
s
,
:attachments
def
setup
@controller
=
WikiController
.
new
...
...
test/integration/issues_api_test.rb
View file @
1f9eda4e
...
...
@@ -39,7 +39,6 @@ class IssuesApiTest < ActionController::IntegrationTest
:custom_fields_trackers
,
:time_entries
,
:journals
,
:journal_details
,
:queries
def
setup
...
...
test/integration/projects_api_test.rb
View file @
1f9eda4e
...
...
@@ -18,7 +18,7 @@
require
"
#{
File
.
dirname
(
__FILE__
)
}
/../test_helper"
class
ProjectsApiTest
<
ActionController
::
IntegrationTest
fixtures
:projects
,
:versions
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:journal_details
,
fixtures
:projects
,
:versions
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:trackers
,
:projects_trackers
,
:issue_statuses
,
:enabled_modules
,
:enumerations
,
:boards
,
:messages
,
:attachments
,
:custom_fields
,
:custom_values
,
:time_entries
...
...
test/test_helper.rb
View file @
1f9eda4e
...
...
@@ -144,21 +144,17 @@ class ActiveSupport::TestCase
end
should
"use the new value's name"
do
@detail
=
JournalDetail
.
generate!
(
:property
=>
'attr'
,
:old_value
=>
@old_value
.
id
,
:value
=>
@new_value
.
id
,
:prop_key
=>
prop_key
)
@detail
=
IssueJournal
.
generate
(
:version
=>
1
)
@detail
.
update_attribute
(
:changes
,
{
prop_key
=>
[
@old_value
.
id
,
@new_value
.
id
]}.
to_yaml
)
assert_match
@new_value
.
name
,
show_detail
(
@detail
,
true
)
assert_match
@new_value
.
name
,
@detail
.
render_detail
(
prop_key
,
true
)
end
should
"use the old value's name"
do
@detail
=
JournalDetail
.
generate!
(
:property
=>
'attr'
,
:old_value
=>
@old_value
.
id
,
:value
=>
@new_value
.
id
,
:prop_key
=>
prop_key
)
@detail
=
IssueJournal
.
generate
(
:version
=>
1
)
@detail
.
update_attribute
(
:changes
,
{
prop_key
=>
[
@old_value
.
id
,
@new_value
.
id
]}.
to_yaml
)
assert_match
@old_value
.
name
,
show_detail
(
@detail
,
true
)
assert_match
@old_value
.
name
,
@detail
.
render_detail
(
prop_key
,
true
)
end
end
end
...
...
test/unit/activity_test.rb
View file @
1f9eda4e
...
...
@@ -18,7 +18,7 @@
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
class
ActivityTest
<
ActiveSupport
::
TestCase
fixtures
:projects
,
:versions
,
:attachments
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:journal_details
,
fixtures
:projects
,
:versions
,
:attachments
,
:users
,
:roles
,
:members
,
:member_roles
,
:issues
,
:journals
,
:trackers
,
:projects_trackers
,
:issue_statuses
,
:enabled_modules
,
:enumerations
,
:boards
,
:messages
def
setup
...
...
@@ -28,7 +28,6 @@ class ActivityTest < ActiveSupport::TestCase
def
test_activity_without_subprojects
events
=
find_events
(
User
.
anonymous
,
:project
=>
@project
)
assert_not_nil
events
assert
events
.
include?
(
Issue
.
find
(
1
))
assert
!
events
.
include?
(
Issue
.
find
(
4
))
# subproject issue
...
...
@@ -51,7 +50,7 @@ class ActivityTest < ActiveSupport::TestCase
assert
events
.
include?
(
Issue
.
find
(
1
))
assert
events
.
include?
(
Message
.
find
(
5
))
# Issue of a private project
assert
!
events
.
include?
(
Issue
.
find
(
4
))
assert
!
events
.
include?
(
Issue
.
find
(
6
))
end
def
test_global_activity_logged_user
...
...
@@ -60,7 +59,7 @@ class ActivityTest < ActiveSupport::TestCase
assert
events
.
include?
(
Issue
.
find
(
1
))
# Issue of a private project the user belongs to
assert
events
.
include?
(
Issue
.
find
(
4
))
assert
events
.
include?
(
Issue
.
find
(
6
))
end
def
test_user_activity
...
...
@@ -87,6 +86,9 @@ class ActivityTest < ActiveSupport::TestCase
private
def
find_events
(
user
,
options
=
{})
Redmine
::
Activity
::
Fetcher
.
new
(
user
,
options
).
events
(
Date
.
today
-
30
,
Date
.
today
+
1
)
events
=
Redmine
::
Activity
::
Fetcher
.
new
(
user
,
options
).
events
(
Date
.
today
-
30
,
Date
.
today
+
1
)
# Because events are provided by the journals, but we want to test for
# their targets here, transform that
events
.
group_by
(
&
:versioned
).
keys
end
end
test/unit/issue_test.rb
View file @
1f9eda4e
...
...
@@ -551,20 +551,21 @@ class IssueTest < ActiveSupport::TestCase
assert_difference
'Journal.count'
do
assert
i
.
save
end
assert
i
.
current_journal
.
changes
.
has_key?
"subject"
assert
i
.
current_journal
.
changes
.
has_key?
"done_ratio"
# 1 more change
i
.
priority
=
IssuePriority
.
find
(
:first
,
:conditions
=>
[
"id <> ?"
,
i
.
priority_id
])
assert_no_difference
'Journal.count'
do
assert_difference
'JournalDetail.count'
,
1
do
assert_difference
'Journal.count'
do
i
.
save
end
end
assert
i
.
current_journal
.
changes
.
has_key?
"priority_id"
# no more change
assert_no_difference
'Journal.count'
do
assert_no_difference
'JournalDetail.count'
do
i
.
save
end
end
end
context
"#done_ratio"
do
setup
do
...
...
test/unit/journal_test.rb
View file @
1f9eda4e
...
...
@@ -18,14 +18,14 @@
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
class
JournalTest
<
ActiveSupport
::
TestCase
fixtures
:issues
,
:issue_statuses
,
:journals
,
:journal_details
fixtures
:issues
,
:issue_statuses
,
:journals
def
setup
@journal
=
Journal
.
find
1
@journal
=
IssueJournal
.
first
end
def
test_journalized_is_an_issue
issue
=
@journal
.
issue
issue
=
@journal
.
journalized
assert_kind_of
Issue
,
issue
assert_equal
1
,
issue
.
id
end
...
...
@@ -41,9 +41,9 @@ class JournalTest < ActiveSupport::TestCase
ActionMailer
::
Base
.
deliveries
.
clear
issue
=
Issue
.
find
(
:first
)
user
=
User
.
find
(
:first
)
journal
=
issue
.
init_journal
(
user
,
issue
)
assert
journal
.
save
assert_equal
0
,
ActionMailer
::
Base
.
deliveries
.
size
issue
.
update_attribute
(
:subject
,
"New subject to trigger automatic journal entry"
)
assert_equal
1
,
ActionMailer
::
Base
.
deliveries
.
size
end
...
...
test/unit/mail_handler_test.rb
View file @
1f9eda4e
...
...
@@ -259,7 +259,7 @@ class MailHandlerTest < ActiveSupport::TestCase
# This email contains: 'Status: Resolved'
journal
=
submit_email
(
'ticket_reply_with_status.eml'
)
assert
journal
.
is_a?
(
Journal
)
issue
=
Issue
.
find
(
journal
.
issue
.
id
)
issue
=
Issue
.
find
(
journal
.
journalized
.
id
)
assert_equal
User
.
find_by_login
(
'jsmith'
),
journal
.
user
assert_equal
Issue
.
find
(
2
),
journal
.
journalized
assert_match
/This is reply/
,
journal
.
notes
...
...
test/unit/mailer_test.rb
View file @
1f9eda4e
...
...
@@ -20,7 +20,7 @@ require File.dirname(__FILE__) + '/../test_helper'
class
MailerTest
<
ActiveSupport
::
TestCase
include
Redmine
::
I18n
include
ActionController
::
Assertions
::
SelectorAssertions
fixtures
:projects
,
:enabled_modules
,
:issues
,
:users
,
:members
,
:member_roles
,
:roles
,
:documents
,
:attachments
,
:news
,
:tokens
,
:journals
,
:
journal_details
,
:
changesets
,
:trackers
,
:issue_statuses
,
:enumerations
,
:messages
,
:boards
,
:repositories
fixtures
:projects
,
:enabled_modules
,
:issues
,
:users
,
:members
,
:member_roles
,
:roles
,
:documents
,
:attachments
,
:news
,
:tokens
,
:journals
,
:changesets
,
:trackers
,
:issue_statuses
,
:enumerations
,
:messages
,
:boards
,
:repositories
def
setup
ActionMailer
::
Base
.
deliveries
.
clear
...
...
test/unit/search_test.rb
View file @
1f9eda4e
...
...
@@ -27,7 +27,6 @@ class SearchTest < ActiveSupport::TestCase
:issues
,
:trackers
,
:journals
,
:journal_details
,
:repositories
,
:changesets
...
...
test/unit/wiki_content_test.rb
View file @
1f9eda4e
...
...
@@ -18,7 +18,7 @@
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
class
WikiContentTest
<
ActiveSupport
::
TestCase
fixtures
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
wiki_content_version
s
,
:users
fixtures
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
journal
s
,
:users
def
setup
@wiki
=
Wiki
.
find
(
1
)
...
...
test/unit/wiki_page_test.rb
View file @
1f9eda4e
...
...
@@ -18,7 +18,7 @@
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
class
WikiPageTest
<
ActiveSupport
::
TestCase
fixtures
:projects
,
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
wiki_content_version
s
fixtures
:projects
,
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
journal
s
def
setup
@wiki
=
Wiki
.
find
(
1
)
...
...
@@ -101,11 +101,14 @@ class WikiPageTest < ActiveSupport::TestCase
def
test_destroy
page
=
WikiPage
.
find
(
1
)
content_ids
=
WikiContent
.
find_all_by_page_id
(
1
).
collect
(
&
:id
)
page
.
destroy
assert_nil
WikiPage
.
find_by_id
(
1
)
# make sure that page content and its history are deleted
assert
WikiContent
.
find_all_by_page_id
(
1
).
empty?
assert
WikiContent
.
versioned_class
.
find_all_by_page_id
(
1
).
empty?
content_ids
.
each
do
|
wiki_content_id
|
assert
WikiContent
.
journal_class
.
find_all_by_versioned_id
(
wiki_content_id
).
empty?
end
end
def
test_destroy_should_not_nullify_children
...
...
test/unit/wiki_test.rb
View file @
1f9eda4e
...
...
@@ -20,7 +20,7 @@
require
File
.
dirname
(
__FILE__
)
+
'/../test_helper'
class
WikiTest
<
ActiveSupport
::
TestCase
fixtures
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
wiki_content_version
s
fixtures
:wikis
,
:wiki_pages
,
:wiki_contents
,
:
journal
s
def
test_create
wiki
=
Wiki
.
new
(
:project
=>
Project
.
find
(
2
))
...
...
vendor/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
View file @
1f9eda4e
...
...
@@ -68,11 +68,11 @@ module Redmine
scope_options
[
:conditions
]
=
cond
.
conditions
if
options
[
:limit
]
# id and creation time should be in same order in most cases
scope_options
[
:order
]
=
"
#{
table_name
}
.id DESC"
scope_options
[
:order
]
=
"
#{
journal_class
.
table_name
}
.id DESC"
scope_options
[
:limit
]
=
options
[
:limit
]
end
with_scope
(
:find
=>
scope_options
)
do
journal_class
.
with_scope
(
:find
=>
scope_options
)
do
journal_class
.
find
(
:all
,
provider_options
[
:find_options
].
dup
)
end
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