@@ -1,31 +1,31 | |||
|
1 | 1 | xml.instruct! |
|
2 | 2 | xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do |
|
3 | 3 | xml.title truncate_single_line(@title, :length => 100) |
|
4 | xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false)) | |
|
5 | xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil)) | |
|
4 | xml.link "rel" => "self", "href" => url_for(params.merge(:only_path => false, :escape => false)) | |
|
5 | xml.link "rel" => "alternate", "href" => url_for(params.merge(:only_path => false, :format => nil, :key => nil, :escape => false)) | |
|
6 | 6 | xml.id url_for(:controller => 'welcome', :only_path => false) |
|
7 | 7 | xml.updated((@items.first ? @items.first.event_datetime : Time.now).xmlschema) |
|
8 | 8 | xml.author { xml.name "#{Setting.app_title}" } |
|
9 | 9 | xml.generator(:uri => Redmine::Info.url) { xml.text! Redmine::Info.app_name; } |
|
10 | 10 | @items.each do |item| |
|
11 | 11 | xml.entry do |
|
12 | 12 | url = url_for(item.event_url(:only_path => false)) |
|
13 | 13 | if @project |
|
14 | 14 | xml.title truncate_single_line(item.event_title, :length => 100) |
|
15 | 15 | else |
|
16 | 16 | xml.title truncate_single_line("#{item.project} - #{item.event_title}", :length => 100) |
|
17 | 17 | end |
|
18 | 18 | xml.link "rel" => "alternate", "href" => url |
|
19 | 19 | xml.id url |
|
20 | 20 | xml.updated item.event_datetime.xmlschema |
|
21 | 21 | author = item.event_author if item.respond_to?(:event_author) |
|
22 | 22 | xml.author do |
|
23 | 23 | xml.name(author) |
|
24 | 24 | xml.email(author.mail) if author.is_a?(User) && !author.mail.blank? && !author.pref.hide_mail |
|
25 | 25 | end if author |
|
26 | 26 | xml.content "type" => "html" do |
|
27 | 27 | xml.text! textilizable(item, :event_description, :only_path => false) |
|
28 | 28 | end |
|
29 | 29 | end |
|
30 | 30 | end |
|
31 | 31 | end |
@@ -1,114 +1,144 | |||
|
1 | 1 | require File.expand_path('../../test_helper', __FILE__) |
|
2 | 2 | |
|
3 | 3 | class ActivitiesControllerTest < ActionController::TestCase |
|
4 | 4 | fixtures :projects, :trackers, :issue_statuses, :issues, |
|
5 | 5 | :enumerations, :users, :issue_categories, |
|
6 | 6 | :projects_trackers, |
|
7 | 7 | :roles, |
|
8 | 8 | :member_roles, |
|
9 | 9 | :members, |
|
10 | 10 | :groups_users, |
|
11 | 11 | :enabled_modules, |
|
12 | 12 | :workflows, |
|
13 | 13 | :auth_sources, |
|
14 | 14 | :journals, :journal_details |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | def test_project_index |
|
18 | 18 | get :index, :id => 1, :with_subprojects => 0 |
|
19 | 19 | assert_response :success |
|
20 | 20 | assert_template 'index' |
|
21 | 21 | assert_not_nil assigns(:events_by_day) |
|
22 | 22 | |
|
23 | 23 | assert_tag :tag => "h3", |
|
24 | 24 | :content => /#{2.days.ago.to_date.day}/, |
|
25 | 25 | :sibling => { :tag => "dl", |
|
26 | 26 | :child => { :tag => "dt", |
|
27 | 27 | :attributes => { :class => /issue-edit/ }, |
|
28 | 28 | :child => { :tag => "a", |
|
29 | 29 | :content => /(#{IssueStatus.find(2).name})/, |
|
30 | 30 | } |
|
31 | 31 | } |
|
32 | 32 | } |
|
33 | 33 | end |
|
34 | 34 | |
|
35 | 35 | def test_project_index_with_invalid_project_id_should_respond_404 |
|
36 | 36 | get :index, :id => 299 |
|
37 | 37 | assert_response 404 |
|
38 | 38 | end |
|
39 | 39 | |
|
40 | 40 | def test_previous_project_index |
|
41 | 41 | get :index, :id => 1, :from => 3.days.ago.to_date |
|
42 | 42 | assert_response :success |
|
43 | 43 | assert_template 'index' |
|
44 | 44 | assert_not_nil assigns(:events_by_day) |
|
45 | 45 | |
|
46 | 46 | assert_tag :tag => "h3", |
|
47 | 47 | :content => /#{3.day.ago.to_date.day}/, |
|
48 | 48 | :sibling => { :tag => "dl", |
|
49 | 49 | :child => { :tag => "dt", |
|
50 | 50 | :attributes => { :class => /issue/ }, |
|
51 | 51 | :child => { :tag => "a", |
|
52 | 52 | :content => /#{Issue.find(1).subject}/, |
|
53 | 53 | } |
|
54 | 54 | } |
|
55 | 55 | } |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | def test_global_index |
|
59 | 59 | get :index |
|
60 | 60 | assert_response :success |
|
61 | 61 | assert_template 'index' |
|
62 | 62 | assert_not_nil assigns(:events_by_day) |
|
63 | 63 | |
|
64 | 64 | assert_tag :tag => "h3", |
|
65 | 65 | :content => /#{5.day.ago.to_date.day}/, |
|
66 | 66 | :sibling => { :tag => "dl", |
|
67 | 67 | :child => { :tag => "dt", |
|
68 | 68 | :attributes => { :class => /issue/ }, |
|
69 | 69 | :child => { :tag => "a", |
|
70 | 70 | :content => /#{Issue.find(5).subject}/, |
|
71 | 71 | } |
|
72 | 72 | } |
|
73 | 73 | } |
|
74 | 74 | end |
|
75 | 75 | |
|
76 | 76 | def test_user_index |
|
77 | 77 | get :index, :user_id => 2 |
|
78 | 78 | assert_response :success |
|
79 | 79 | assert_template 'index' |
|
80 | 80 | assert_not_nil assigns(:events_by_day) |
|
81 | 81 | |
|
82 | 82 | assert_tag :tag => "h3", |
|
83 | 83 | :content => /#{3.day.ago.to_date.day}/, |
|
84 | 84 | :sibling => { :tag => "dl", |
|
85 | 85 | :child => { :tag => "dt", |
|
86 | 86 | :attributes => { :class => /issue/ }, |
|
87 | 87 | :child => { :tag => "a", |
|
88 | 88 | :content => /#{Issue.find(1).subject}/, |
|
89 | 89 | } |
|
90 | 90 | } |
|
91 | 91 | } |
|
92 | 92 | end |
|
93 | 93 | |
|
94 | 94 | def test_user_index_with_invalid_user_id_should_respond_404 |
|
95 | 95 | get :index, :user_id => 299 |
|
96 | 96 | assert_response 404 |
|
97 | 97 | end |
|
98 | 98 | |
|
99 | 99 | def test_index_atom_feed |
|
100 | get :index, :format => 'atom' | |
|
100 | get :index, :format => 'atom', :with_subprojects => 0 | |
|
101 | 101 | assert_response :success |
|
102 | 102 | assert_template 'common/feed.atom' |
|
103 | ||
|
104 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
|
105 | :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'} | |
|
106 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
|
107 | :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'} | |
|
108 | ||
|
109 | assert_tag :tag => 'entry', :child => { | |
|
110 | :tag => 'link', | |
|
111 | :attributes => {:href => 'http://test.host/issues/11'}} | |
|
112 | end | |
|
113 | ||
|
114 | def test_index_atom_feed_with_explicit_selection | |
|
115 | get :index, :format => 'atom', :with_subprojects => 0, | |
|
116 | :show_changesets => 1, | |
|
117 | :show_documents => 1, | |
|
118 | :show_files => 1, | |
|
119 | :show_issues => 1, | |
|
120 | :show_messages => 1, | |
|
121 | :show_news => 1, | |
|
122 | :show_time_entries => 1, | |
|
123 | :show_wiki_edits => 1 | |
|
124 | ||
|
125 | assert_response :success | |
|
126 | assert_template 'common/feed.atom' | |
|
127 | ||
|
128 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
|
129 | :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'} | |
|
130 | assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
|
131 | :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?show_changesets=1&show_documents=1&show_files=1&show_issues=1&show_messages=1&show_news=1&show_time_entries=1&show_wiki_edits=1&with_subprojects=0'} | |
|
132 | ||
|
103 | 133 | assert_tag :tag => 'entry', :child => { |
|
104 | 134 | :tag => 'link', |
|
105 | 135 | :attributes => {:href => 'http://test.host/issues/11'}} |
|
106 | 136 | end |
|
107 | 137 | |
|
108 | 138 | def test_index_atom_feed_with_one_item_type |
|
109 | 139 | get :index, :format => 'atom', :show_issues => '1' |
|
110 | 140 | assert_response :success |
|
111 | 141 | assert_template 'common/feed.atom' |
|
112 | 142 | assert_tag :tag => 'title', :content => /Issues/ |
|
113 | 143 | end |
|
114 | 144 | end |
General Comments 0
You need to be logged in to leave comments.
Login now