Mercurial > hg > soundsoftware-site
comparison test/functional/activities_controller_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 3e4c3460b6ca |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
8 :member_roles, | 8 :member_roles, |
9 :members, | 9 :members, |
10 :groups_users, | 10 :groups_users, |
11 :enabled_modules, | 11 :enabled_modules, |
12 :workflows, | 12 :workflows, |
13 :auth_sources, | |
14 :journals, :journal_details | 13 :journals, :journal_details |
15 | 14 |
16 | 15 |
17 def test_project_index | 16 def test_project_index |
18 get :index, :id => 1, :with_subprojects => 0 | 17 get :index, :id => 1, :with_subprojects => 0 |
47 :content => /#{3.day.ago.to_date.day}/, | 46 :content => /#{3.day.ago.to_date.day}/, |
48 :sibling => { :tag => "dl", | 47 :sibling => { :tag => "dl", |
49 :child => { :tag => "dt", | 48 :child => { :tag => "dt", |
50 :attributes => { :class => /issue/ }, | 49 :attributes => { :class => /issue/ }, |
51 :child => { :tag => "a", | 50 :child => { :tag => "a", |
52 :content => /#{Issue.find(1).subject}/, | 51 :content => /Can't print recipes/, |
53 } | 52 } |
54 } | 53 } |
55 } | 54 } |
56 end | 55 end |
57 | 56 |
58 def test_global_index | 57 def test_global_index |
58 @request.session[:user_id] = 1 | |
59 get :index | 59 get :index |
60 assert_response :success | 60 assert_response :success |
61 assert_template 'index' | 61 assert_template 'index' |
62 assert_not_nil assigns(:events_by_day) | 62 assert_not_nil assigns(:events_by_day) |
63 | 63 |
64 i5 = Issue.find(5) | |
65 d5 = User.find(1).time_to_date(i5.created_on) | |
64 assert_tag :tag => "h3", | 66 assert_tag :tag => "h3", |
65 :content => /#{5.day.ago.to_date.day}/, | 67 :content => /#{d5.day}/, |
66 :sibling => { :tag => "dl", | 68 :sibling => { :tag => "dl", |
67 :child => { :tag => "dt", | 69 :child => { :tag => "dt", |
68 :attributes => { :class => /issue/ }, | 70 :attributes => { :class => /issue/ }, |
69 :child => { :tag => "a", | 71 :child => { :tag => "a", |
70 :content => /#{Issue.find(5).subject}/, | 72 :content => /Subproject issue/, |
71 } | 73 } |
72 } | 74 } |
73 } | 75 } |
74 end | 76 end |
75 | 77 |
76 def test_user_index | 78 def test_user_index |
79 @request.session[:user_id] = 1 | |
77 get :index, :user_id => 2 | 80 get :index, :user_id => 2 |
78 assert_response :success | 81 assert_response :success |
79 assert_template 'index' | 82 assert_template 'index' |
80 assert_not_nil assigns(:events_by_day) | 83 assert_not_nil assigns(:events_by_day) |
81 | 84 |
85 assert_select 'h2 a[href=/users/2]', :text => 'John Smith' | |
86 | |
87 i1 = Issue.find(1) | |
88 d1 = User.find(1).time_to_date(i1.created_on) | |
89 | |
82 assert_tag :tag => "h3", | 90 assert_tag :tag => "h3", |
83 :content => /#{3.day.ago.to_date.day}/, | 91 :content => /#{d1.day}/, |
84 :sibling => { :tag => "dl", | 92 :sibling => { :tag => "dl", |
85 :child => { :tag => "dt", | 93 :child => { :tag => "dt", |
86 :attributes => { :class => /issue/ }, | 94 :attributes => { :class => /issue/ }, |
87 :child => { :tag => "a", | 95 :child => { :tag => "a", |
88 :content => /#{Issue.find(1).subject}/, | 96 :content => /Can't print recipes/, |
89 } | 97 } |
90 } | 98 } |
91 } | 99 } |
92 end | 100 end |
93 | 101 |
95 get :index, :user_id => 299 | 103 get :index, :user_id => 299 |
96 assert_response 404 | 104 assert_response 404 |
97 end | 105 end |
98 | 106 |
99 def test_index_atom_feed | 107 def test_index_atom_feed |
100 get :index, :format => 'atom' | 108 get :index, :format => 'atom', :with_subprojects => 0 |
101 assert_response :success | 109 assert_response :success |
102 assert_template 'common/feed.atom' | 110 assert_template 'common/feed' |
111 | |
112 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
113 :attributes => {:rel => 'self', :href => 'http://test.host/activity.atom?with_subprojects=0'} | |
114 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
115 :attributes => {:rel => 'alternate', :href => 'http://test.host/activity?with_subprojects=0'} | |
116 | |
117 assert_tag :tag => 'entry', :child => { | |
118 :tag => 'link', | |
119 :attributes => {:href => 'http://test.host/issues/11'}} | |
120 end | |
121 | |
122 def test_index_atom_feed_with_explicit_selection | |
123 get :index, :format => 'atom', :with_subprojects => 0, | |
124 :show_changesets => 1, | |
125 :show_documents => 1, | |
126 :show_files => 1, | |
127 :show_issues => 1, | |
128 :show_messages => 1, | |
129 :show_news => 1, | |
130 :show_time_entries => 1, | |
131 :show_wiki_edits => 1 | |
132 | |
133 assert_response :success | |
134 assert_template 'common/feed' | |
135 | |
136 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
137 :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'} | |
138 assert_tag :tag => 'link', :parent => {:tag => 'feed', :parent => nil }, | |
139 :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'} | |
140 | |
103 assert_tag :tag => 'entry', :child => { | 141 assert_tag :tag => 'entry', :child => { |
104 :tag => 'link', | 142 :tag => 'link', |
105 :attributes => {:href => 'http://test.host/issues/11'}} | 143 :attributes => {:href => 'http://test.host/issues/11'}} |
106 end | 144 end |
107 | 145 |
108 def test_index_atom_feed_with_one_item_type | 146 def test_index_atom_feed_with_one_item_type |
109 get :index, :format => 'atom', :show_issues => '1' | 147 get :index, :format => 'atom', :show_issues => '1' |
110 assert_response :success | 148 assert_response :success |
111 assert_template 'common/feed.atom' | 149 assert_template 'common/feed' |
112 assert_tag :tag => 'title', :content => /Issues/ | 150 assert_tag :tag => 'title', :content => /Issues/ |
113 end | 151 end |
152 | |
153 def test_index_should_show_private_notes_with_permission_only | |
154 journal = Journal.create!(:journalized => Issue.find(2), :notes => 'Private notes with searchkeyword', :private_notes => true) | |
155 @request.session[:user_id] = 2 | |
156 | |
157 get :index | |
158 assert_response :success | |
159 assert_include journal, assigns(:events_by_day).values.flatten | |
160 | |
161 Role.find(1).remove_permission! :view_private_notes | |
162 get :index | |
163 assert_response :success | |
164 assert_not_include journal, assigns(:events_by_day).values.flatten | |
165 end | |
114 end | 166 end |