3 class DiaryEntryControllerTest < ActionController::TestCase
4 fixtures :users, :user_roles, :diary_entries, :diary_comments, :languages, :friends
6 include ActionView::Helpers::NumberHelper
9 # test all routes which lead to this controller
12 { :path => "/diary", :method => :get },
13 { :controller => "diary_entry", :action => "list" }
16 { :path => "/diary/language", :method => :get },
17 { :controller => "diary_entry", :action => "list", :language => "language" }
20 { :path => "/user/username/diary", :method => :get },
21 { :controller => "diary_entry", :action => "list", :display_name => "username" }
24 { :path => "/diary/friends", :method => :get },
25 { :controller => "diary_entry", :action => "list", :friends => true }
28 { :path => "/diary/nearby", :method => :get },
29 { :controller => "diary_entry", :action => "list", :nearby => true }
33 { :path => "/diary/rss", :method => :get },
34 { :controller => "diary_entry", :action => "rss", :format => :rss }
37 { :path => "/diary/language/rss", :method => :get },
38 { :controller => "diary_entry", :action => "rss", :language => "language", :format => :rss }
41 { :path => "/user/username/diary/rss", :method => :get },
42 { :controller => "diary_entry", :action => "rss", :display_name => "username", :format => :rss }
46 { :path => "/user/username/diary/comments", :method => :get },
47 { :controller => "diary_entry", :action => "comments", :display_name => "username" }
50 { :path => "/user/username/diary/comments/1", :method => :get },
51 { :controller => "diary_entry", :action => "comments", :display_name => "username", :page => "1" }
55 { :path => "/diary/new", :method => :get },
56 { :controller => "diary_entry", :action => "new" }
59 { :path => "/diary/new", :method => :post },
60 { :controller => "diary_entry", :action => "new" }
63 { :path => "/user/username/diary/1", :method => :get },
64 { :controller => "diary_entry", :action => "view", :display_name => "username", :id => "1" }
67 { :path => "/user/username/diary/1/edit", :method => :get },
68 { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
71 { :path => "/user/username/diary/1/edit", :method => :post },
72 { :controller => "diary_entry", :action => "edit", :display_name => "username", :id => "1" }
75 { :path => "/user/username/diary/1/newcomment", :method => :post },
76 { :controller => "diary_entry", :action => "comment", :display_name => "username", :id => "1" }
79 { :path => "/user/username/diary/1/hide", :method => :post },
80 { :controller => "diary_entry", :action => "hide", :display_name => "username", :id => "1" }
83 { :path => "/user/username/diary/1/hidecomment/2", :method => :post },
84 { :controller => "diary_entry", :action => "hidecomment", :display_name => "username", :id => "1", :comment => "2" }
89 # Make sure that you are redirected to the login page when you
92 assert_response :redirect
93 assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/new"
95 # Now try again when logged in
96 get :new, {}, { :user => users(:normal_user).id }
97 assert_response :success
98 assert_select "title", :text => /New Diary Entry/, :count => 1
99 assert_select "div.content-heading", :count => 1 do
100 assert_select "h1", :text => /New Diary Entry/, :count => 1
102 assert_select "div#content", :count => 1 do
103 assert_select "form[action='/diary/new'][method=post]", :count => 1 do
104 assert_select "input#diary_entry_title[name='diary_entry[title]']", :count => 1
105 assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => "", :count => 1
106 assert_select "select#diary_entry_language_code", :count => 1
107 assert_select "input#latitude[name='diary_entry[latitude]']", :count => 1
108 assert_select "input#longitude[name='diary_entry[longitude]']", :count => 1
109 assert_select "input[name=commit][type=submit][value=Save]", :count => 1
110 assert_select "input[name=commit][type=submit][value=Edit]", :count => 1
111 assert_select "input[name=commit][type=submit][value=Preview]", :count => 1
112 assert_select "input", :count => 7
116 new_title = "New Title"
117 new_body = "This is a new body for the diary entry"
119 new_longitude = "2.2"
120 new_language_code = "en"
122 # Now try creating a invalid diary entry with an empty body
123 assert_no_difference "DiaryEntry.count" do
124 post :new, { :commit => "save",
125 :diary_entry => { :title => new_title, :body => "", :latitude => new_latitude,
126 :longitude => new_longitude, :language_code => new_language_code } },
127 { :user => users(:normal_user).id }
129 assert_response :success
130 assert_template :edit
132 assert_nil UserPreference.where(:user_id => users(:normal_user).id, :k => "diary.default_language").first
134 # Now try creating a diary entry
135 assert_difference "DiaryEntry.count", 1 do
136 post :new, { :commit => "save",
137 :diary_entry => { :title => new_title, :body => new_body, :latitude => new_latitude,
138 :longitude => new_longitude, :language_code => new_language_code } },
139 { :user => users(:normal_user).id }
141 assert_response :redirect
142 assert_redirected_to :action => :list, :display_name => users(:normal_user).display_name
143 entry = DiaryEntry.order(:id).last
144 assert_equal users(:normal_user).id, entry.user_id
145 assert_equal new_title, entry.title
146 assert_equal new_body, entry.body
147 assert_equal new_latitude.to_f, entry.latitude
148 assert_equal new_longitude.to_f, entry.longitude
149 assert_equal new_language_code, entry.language_code
151 assert_equal new_language_code, UserPreference.where(:user_id => users(:normal_user).id, :k => "diary.default_language").first.v
153 new_language_code = "de"
155 # Now try creating a diary entry in a different language
156 assert_difference "DiaryEntry.count", 1 do
157 post :new, { :commit => "save",
158 :diary_entry => { :title => new_title, :body => new_body, :latitude => new_latitude,
159 :longitude => new_longitude, :language_code => new_language_code } },
160 { :user => users(:normal_user).id }
162 assert_response :redirect
163 assert_redirected_to :action => :list, :display_name => users(:normal_user).display_name
164 entry = DiaryEntry.order(:id).last
165 assert_equal users(:normal_user).id, entry.user_id
166 assert_equal new_title, entry.title
167 assert_equal new_body, entry.body
168 assert_equal new_latitude.to_f, entry.latitude
169 assert_equal new_longitude.to_f, entry.longitude
170 assert_equal new_language_code, entry.language_code
172 assert_equal new_language_code, UserPreference.where(:user_id => users(:normal_user).id, :k => "diary.default_language").first.v
176 # Generate some spammy content
177 spammy_title = "Spam Spam Spam Spam Spam"
178 spammy_body = 1.upto(50).map { |n| "http://example.com/spam#{n}" }.join(" ")
180 # Try creating a spammy diary entry
181 assert_difference "DiaryEntry.count", 1 do
182 post :new, { :commit => "save",
183 :diary_entry => { :title => spammy_title, :body => spammy_body, :language_code => "en" } },
184 { :user => users(:normal_user).id }
186 assert_response :redirect
187 assert_redirected_to :action => :list, :display_name => users(:normal_user).display_name
188 entry = DiaryEntry.order(:id).last
189 assert_equal users(:normal_user).id, entry.user_id
190 assert_equal spammy_title, entry.title
191 assert_equal spammy_body, entry.body
192 assert_equal "en", entry.language_code
193 assert_equal "suspended", User.find(users(:normal_user).id).status
195 # Follow the redirect
196 get :list, { :display_name => users(:normal_user).display_name }, { :user => users(:normal_user).id }
197 assert_response :redirect
198 assert_redirected_to :controller => :user, :action => :suspended
202 entry = diary_entries(:normal_user_entry_1)
204 # Make sure that you are redirected to the login page when you are
205 # not logged in, without and with the id of the entry you want to edit
206 get :edit, :display_name => entry.user.display_name, :id => entry.id
207 assert_response :redirect
208 assert_redirected_to :controller => :user, :action => :login, :referer => "/user/#{entry.user.display_name}/diary/#{entry.id}/edit"
210 # Verify that you get a not found error, when you pass a bogus id
211 get :edit, { :display_name => entry.user.display_name, :id => 9999 }, { :user => entry.user.id }
212 assert_response :not_found
213 assert_select "div.content-heading", :count => 1 do
214 assert_select "h2", :text => "No entry with the id: 9999", :count => 1
217 # Verify that you get redirected to view if you are not the user
218 # that created the entry
219 get :edit, { :display_name => entry.user.display_name, :id => entry.id }, { :user => users(:public_user).id }
220 assert_response :redirect
221 assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id
223 # Now pass the id, and check that you can edit it, when using the same
224 # user as the person who created the entry
225 get :edit, { :display_name => entry.user.display_name, :id => entry.id }, { :user => entry.user.id }
226 assert_response :success
227 assert_select "title", :text => /Edit diary entry/, :count => 1
228 assert_select "div.content-heading", :count => 1 do
229 assert_select "h1", :text => /Edit diary entry/, :count => 1
231 assert_select "div#content", :count => 1 do
232 assert_select "form[action='/user/#{entry.user.display_name}/diary/#{entry.id}/edit'][method=post]", :count => 1 do
233 assert_select "input#diary_entry_title[name='diary_entry[title]'][value='#{entry.title}']", :count => 1
234 assert_select "textarea#diary_entry_body[name='diary_entry[body]']", :text => entry.body, :count => 1
235 assert_select "select#diary_entry_language_code", :count => 1
236 assert_select "input#latitude[name='diary_entry[latitude]']", :count => 1
237 assert_select "input#longitude[name='diary_entry[longitude]']", :count => 1
238 assert_select "input[name=commit][type=submit][value=Save]", :count => 1
239 assert_select "input[name=commit][type=submit][value=Edit]", :count => 1
240 assert_select "input[name=commit][type=submit][value=Preview]", :count => 1
241 assert_select "input", :count => 7
245 # Now lets see if you can edit the diary entry
246 new_title = "New Title"
247 new_body = "This is a new body for the diary entry"
249 new_longitude = "2.2"
250 new_language_code = "en"
251 post :edit, { :display_name => entry.user.display_name, :id => entry.id, :commit => "save",
252 :diary_entry => { :title => new_title, :body => new_body, :latitude => new_latitude,
253 :longitude => new_longitude, :language_code => new_language_code } },
254 { :user => entry.user.id }
255 assert_response :redirect
256 assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id
258 # Now check that the new data is rendered, when logged in
259 get :view, { :display_name => entry.user.display_name, :id => entry.id }, { :user => entry.user.id }
260 assert_response :success
261 assert_template "diary_entry/view"
262 assert_select "title", :text => /Users' diaries | /, :count => 1
263 assert_select "div.content-heading", :count => 1 do
264 assert_select "h2", :text => /#{entry.user.display_name}'s diary/, :count => 1
266 assert_select "div#content", :count => 1 do
267 assert_select "div.post_heading", :text => /#{new_title}/, :count => 1
268 # This next line won't work if the text has been run through the htmlize function
269 # due to formatting that could be introduced
270 assert_select "p", :text => /#{new_body}/, :count => 1
271 assert_select "abbr[class='geo'][title='#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}']", :count => 1
272 # As we're not logged in, check that you cannot edit
273 # print @response.body
274 assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1
277 # and when not logged in as the user who wrote the entry
278 get :view, { :display_name => entry.user.display_name, :id => entry.id }, { :user => entry.user.id }
279 assert_response :success
280 assert_template "diary_entry/view"
281 assert_select "title", :text => /Users' diaries | /, :count => 1
282 assert_select "div.content-heading", :count => 1 do
283 assert_select "h2", :text => /#{users(:normal_user).display_name}'s diary/, :count => 1
285 assert_select "div#content", :count => 1 do
286 assert_select "div.post_heading", :text => /#{new_title}/, :count => 1
287 # This next line won't work if the text has been run through the htmlize function
288 # due to formatting that could be introduced
289 assert_select "p", :text => /#{new_body}/, :count => 1
290 assert_select "abbr[class=geo][title='#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}']", :count => 1
291 # As we're not logged in, check that you cannot edit
292 assert_select "li[class='hidden show_if_user_#{entry.user.id}']", :count => 1 do
293 assert_select "a[href='/user/#{entry.user.display_name}/diary/#{entry.id}/edit']", :text => "Edit this entry", :count => 1
299 get :edit, { :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id }, { :user => users(:normal_user).id }
300 assert_response :success
301 assert_select "span[class=translation_missing]", false, "Missing translation in edit diary entry"
305 entry = diary_entries(:normal_user_entry_1)
307 # Make sure that you are denied when you are not logged in
308 post :comment, :display_name => entry.user.display_name, :id => entry.id
309 assert_response :forbidden
311 # Verify that you get a not found error, when you pass a bogus id
312 post :comment, { :display_name => entry.user.display_name, :id => 9999 }, { :user => users(:public_user).id }
313 assert_response :not_found
314 assert_select "div.content-heading", :count => 1 do
315 assert_select "h2", :text => "No entry with the id: 9999", :count => 1
318 # Now try an invalid comment with an empty body
319 assert_no_difference "ActionMailer::Base.deliveries.size" do
320 assert_no_difference "DiaryComment.count" do
321 post :comment, { :display_name => entry.user.display_name, :id => entry.id, :diary_comment => { :body => "" } }, { :user => users(:public_user).id }
324 assert_response :success
325 assert_template :view
327 # Now try again with the right id
328 assert_difference "ActionMailer::Base.deliveries.size", 1 do
329 assert_difference "DiaryComment.count", 1 do
330 post :comment, { :display_name => entry.user.display_name, :id => entry.id, :diary_comment => { :body => "New comment" } }, { :user => users(:public_user).id }
333 assert_response :redirect
334 assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id
335 email = ActionMailer::Base.deliveries.first
336 assert_equal [users(:normal_user).email], email.to
337 assert_equal "[OpenStreetMap] #{users(:public_user).display_name} commented on your diary entry", email.subject
338 assert_match /New comment/, email.text_part.decoded
339 assert_match /New comment/, email.html_part.decoded
340 ActionMailer::Base.deliveries.clear
341 comment = DiaryComment.order(:id).last
342 assert_equal entry.id, comment.diary_entry_id
343 assert_equal users(:public_user).id, comment.user_id
344 assert_equal "New comment", comment.body
346 # Now view the diary entry, and check the new comment is present
347 get :view, :display_name => entry.user.display_name, :id => entry.id
348 assert_response :success
349 assert_select ".diary-comment", :count => 1 do
350 assert_select "#comment#{comment.id}", :count => 1 do
351 assert_select "a[href='/user/#{users(:public_user).display_name}']", :text => users(:public_user).display_name, :count => 1
353 assert_select ".richtext", :text => /New comment/, :count => 1
357 def test_comment_spammy
358 # Find the entry to comment on
359 entry = diary_entries(:normal_user_entry_1)
361 # Generate some spammy content
362 spammy_text = 1.upto(50).map { |n| "http://example.com/spam#{n}" }.join(" ")
364 # Try creating a spammy comment
365 assert_difference "ActionMailer::Base.deliveries.size", 1 do
366 assert_difference "DiaryComment.count", 1 do
367 post :comment, { :display_name => entry.user.display_name, :id => entry.id, :diary_comment => { :body => spammy_text } }, { :user => users(:public_user).id }
370 assert_response :redirect
371 assert_redirected_to :action => :view, :display_name => entry.user.display_name, :id => entry.id
372 email = ActionMailer::Base.deliveries.first
373 assert_equal [users(:normal_user).email], email.to
374 assert_equal "[OpenStreetMap] #{users(:public_user).display_name} commented on your diary entry", email.subject
375 assert_match %r{http://example.com/spam}, email.text_part.decoded
376 assert_match %r{http://example.com/spam}, email.html_part.decoded
377 ActionMailer::Base.deliveries.clear
378 comment = DiaryComment.order(:id).last
379 assert_equal entry.id, comment.diary_entry_id
380 assert_equal users(:public_user).id, comment.user_id
381 assert_equal spammy_text, comment.body
382 assert_equal "suspended", User.find(users(:public_user).id).status
384 # Follow the redirect
385 get :list, { :display_name => users(:normal_user).display_name }, { :user => users(:public_user).id }
386 assert_response :redirect
387 assert_redirected_to :controller => :user, :action => :suspended
389 # Now view the diary entry, and check the new comment is not present
390 get :view, :display_name => entry.user.display_name, :id => entry.id
391 assert_response :success
392 assert_select ".diary-comment", :count => 0
396 # Try a list of all diary entries
398 check_diary_list :normal_user_entry_1, :normal_user_geo_entry, :public_user_entry_1
402 # Try a list of diary entries for a valid user
403 get :list, :display_name => users(:normal_user).display_name
404 check_diary_list :normal_user_entry_1, :normal_user_geo_entry
406 # Try a list of diary entries for an invalid user
407 get :list, :display_name => "No Such User"
408 assert_response :not_found
409 assert_template "user/no_such_user"
412 def test_list_friends
413 # Try a list of diary entries for your friends when not logged in
414 get :list, :friends => true
415 assert_response :redirect
416 assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/friends"
418 # Try a list of diary entries for your friends when logged in
419 get :list, { :friends => true }, { :user => users(:normal_user).id }
420 check_diary_list :public_user_entry_1
421 get :list, { :friends => true }, { :user => users(:public_user).id }
426 # Try a list of diary entries for nearby users when not logged in
427 get :list, :nearby => true
428 assert_response :redirect
429 assert_redirected_to :controller => :user, :action => :login, :referer => "/diary/nearby"
431 # Try a list of diary entries for nearby users when logged in
432 get :list, { :nearby => true }, { :user => users(:german_user).id }
433 check_diary_list :public_user_entry_1
434 get :list, { :nearby => true }, { :user => users(:public_user).id }
438 def test_list_language
439 # Try a list of diary entries in english
440 get :list, :language => "en"
441 check_diary_list :normal_user_entry_1, :public_user_entry_1
443 # Try a list of diary entries in german
444 get :list, :language => "de"
445 check_diary_list :normal_user_geo_entry
447 # Try a list of diary entries in slovenian
448 get :list, :language => "sl"
453 get :rss, :format => :rss
454 assert_response :success, "Should be able to get a diary RSS"
455 assert_select "rss", :count => 1 do
456 assert_select "channel", :count => 1 do
457 assert_select "channel>title", :count => 1
458 assert_select "image", :count => 1
459 assert_select "channel>item", :count => 3
464 def test_rss_language
465 get :rss, :language => diary_entries(:normal_user_entry_1).language_code, :format => :rss
466 assert_response :success, "Should be able to get a specific language diary RSS"
467 assert_select "rss>channel>item", :count => 2 # , "Diary entries should be filtered by language"
470 # def test_rss_nonexisting_language
471 # get :rss, {:language => 'xx', :format => :rss}
472 # assert_response :not_found, "Should not be able to get a nonexisting language diary RSS"
475 def test_rss_language_with_no_entries
476 get :rss, :language => "sl", :format => :rss
477 assert_response :success, "Should be able to get a specific language diary RSS"
478 assert_select "rss>channel>item", :count => 0 # , "Diary entries should be filtered by language"
482 get :rss, :display_name => users(:normal_user).display_name, :format => :rss
483 assert_response :success, "Should be able to get a specific users diary RSS"
484 assert_select "rss>channel>item", :count => 2 # , "Diary entries should be filtered by user"
487 def test_rss_nonexisting_user
488 # Try a user that has never existed
489 get :rss, :display_name => "fakeUsername76543", :format => :rss
490 assert_response :not_found, "Should not be able to get a nonexisting users diary RSS"
492 # Try a suspended user
493 get :rss, :display_name => users(:suspended_user).display_name, :format => :rss
494 assert_response :not_found, "Should not be able to get a suspended users diary RSS"
497 get :rss, :display_name => users(:deleted_user).display_name, :format => :rss
498 assert_response :not_found, "Should not be able to get a deleted users diary RSS"
502 # Try a normal entry that should work
503 get :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id
504 assert_response :success
505 assert_template :view
507 # Try a deleted entry
508 get :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:deleted_entry).id
509 assert_response :not_found
511 # Try an entry by a suspended user
512 get :view, :display_name => users(:suspended_user).display_name, :id => diary_entries(:entry_by_suspended_user).id
513 assert_response :not_found
515 # Try an entry by a deleted user
516 get :view, :display_name => users(:deleted_user).display_name, :id => diary_entries(:entry_by_deleted_user).id
517 assert_response :not_found
520 def test_view_hidden_comments
521 # Get a diary entry that has hidden comments
522 get :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id
523 assert_response :success
524 assert_template :view
525 assert_select "div.comments" do
526 assert_select "p#comment1", :count => 1 # visible comment
527 assert_select "p#comment2", :count => 0 # comment by suspended user
528 assert_select "p#comment3", :count => 0 # comment by deleted user
529 assert_select "p#comment4", :count => 0 # hidden comment
534 # Try without logging in
535 post :hide, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id
536 assert_response :forbidden
537 assert_equal true, DiaryEntry.find(diary_entries(:normal_user_entry_1).id).visible
539 # Now try as a normal user
540 post :hide, { :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id }, { :user => users(:normal_user).id }
541 assert_response :redirect
542 assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id
543 assert_equal true, DiaryEntry.find(diary_entries(:normal_user_entry_1).id).visible
545 # Finally try as an administrator
546 post :hide, { :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_entry_1).id }, { :user => users(:administrator_user).id }
547 assert_response :redirect
548 assert_redirected_to :action => :list, :display_name => users(:normal_user).display_name
549 assert_equal false, DiaryEntry.find(diary_entries(:normal_user_entry_1).id).visible
553 # Try without logging in
554 post :hidecomment, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id, :comment => diary_comments(:comment_for_geo_post).id
555 assert_response :forbidden
556 assert_equal true, DiaryComment.find(diary_comments(:comment_for_geo_post).id).visible
558 # Now try as a normal user
559 post :hidecomment, { :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id, :comment => diary_comments(:comment_for_geo_post).id }, { :user => users(:normal_user).id }
560 assert_response :redirect
561 assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id
562 assert_equal true, DiaryComment.find(diary_comments(:comment_for_geo_post).id).visible
564 # Finally try as an administrator
565 post :hidecomment, { :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id, :comment => diary_comments(:comment_for_geo_post).id }, { :user => users(:administrator_user).id }
566 assert_response :redirect
567 assert_redirected_to :action => :view, :display_name => users(:normal_user).display_name, :id => diary_entries(:normal_user_geo_entry).id
568 assert_equal false, DiaryComment.find(diary_comments(:comment_for_geo_post).id).visible
572 # Test a user with no comments
573 get :comments, :display_name => users(:normal_user).display_name
574 assert_response :success
575 assert_template :comments
576 assert_select "table.messages" do
577 assert_select "tr", :count => 1 # header, no comments
580 # Test a user with a comment
581 get :comments, :display_name => users(:public_user).display_name
582 assert_response :success
583 assert_template :comments
584 assert_select "table.messages" do
585 assert_select "tr", :count => 2 # header and one comment
588 # Test a suspended user
589 get :comments, :display_name => users(:suspended_user).display_name
590 assert_response :not_found
592 # Test a deleted user
593 get :comments, :display_name => users(:deleted_user).display_name
594 assert_response :not_found
599 def check_diary_list(*entries)
600 assert_response :success
601 assert_template "list"
602 assert_no_missing_translations
603 assert_select "div.diary_post", entries.count
605 entries.each do |entry|
606 entry = diary_entries(entry)
607 assert_select "a[href=?]", "/user/#{entry.user.display_name}/diary/#{entry.id}"