X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/392d3d12264c83d7ab03d34471792476fac31cf6..f1ca64ff84ee66de0fde80ed437e837a79a6e4d8:/test/controllers/diary_comments_controller_test.rb diff --git a/test/controllers/diary_comments_controller_test.rb b/test/controllers/diary_comments_controller_test.rb index 2ebf52d16..a06565aa1 100644 --- a/test/controllers/diary_comments_controller_test.rb +++ b/test/controllers/diary_comments_controller_test.rb @@ -13,15 +13,15 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest { :controller => "diary_comments", :action => "index", :display_name => "username" } ) assert_routing( - { :path => "/user/username/diary/1/newcomment", :method => :post }, + { :path => "/user/username/diary/1/comments", :method => :post }, { :controller => "diary_comments", :action => "create", :display_name => "username", :id => "1" } ) assert_routing( - { :path => "/user/username/diary/1/hidecomment/2", :method => :post }, + { :path => "/user/username/diary/1/comments/2/hide", :method => :post }, { :controller => "diary_comments", :action => "hide", :display_name => "username", :id => "1", :comment => "2" } ) assert_routing( - { :path => "/user/username/diary/1/unhidecomment/2", :method => :post }, + { :path => "/user/username/diary/1/comments/2/unhide", :method => :post }, { :controller => "diary_comments", :action => "unhide", :display_name => "username", :id => "1", :comment => "2" } ) @@ -115,14 +115,14 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest end end end - assert_redirected_to diary_entry_path(entry.user, entry) + comment = DiaryComment.last + assert_redirected_to diary_entry_path(entry.user, entry, :anchor => "comment#{comment.id}") email = ActionMailer::Base.deliveries.first assert_equal [user.email], email.to assert_equal "[OpenStreetMap] #{other_user.display_name} commented on a diary entry", email.subject assert_match(/New comment/, email.text_part.decoded) assert_match(/New comment/, email.html_part.decoded) ActionMailer::Base.deliveries.clear - comment = DiaryComment.order(:id).last assert_equal entry.id, comment.diary_entry_id assert_equal other_user.id, comment.user_id assert_equal "New comment", comment.body @@ -157,14 +157,14 @@ class DiaryCommentsControllerTest < ActionDispatch::IntegrationTest end end end - assert_redirected_to diary_entry_path(entry.user, entry) + comment = DiaryComment.last + assert_redirected_to diary_entry_path(entry.user, entry, :anchor => "comment#{comment.id}") email = ActionMailer::Base.deliveries.first assert_equal [user.email], email.to assert_equal "[OpenStreetMap] #{other_user.display_name} commented on a diary entry", email.subject assert_match %r{http://example.com/spam}, email.text_part.decoded assert_match %r{http://example.com/spam}, email.html_part.decoded ActionMailer::Base.deliveries.clear - comment = DiaryComment.order(:id).last assert_equal entry.id, comment.diary_entry_id assert_equal other_user.id, comment.user_id assert_equal spammy_text, comment.body