)
assert_routing(
{ :path => "/api/0.6/changeset/comment/1/hide", :method => :post },
- { :controller => "changeset_comments", :action => "hide_comment", :id => "1" }
+ { :controller => "changeset_comments", :action => "destroy", :id => "1" }
)
assert_routing(
{ :path => "/api/0.6/changeset/comment/1/unhide", :method => :post },
- { :controller => "changeset_comments", :action => "unhide_comment", :id => "1" }
+ { :controller => "changeset_comments", :action => "restore", :id => "1" }
)
assert_routing(
{ :path => "/changeset/1/comments/feed", :method => :get },
- { :controller => "changeset_comments", :action => "comments_feed", :id => "1", :format => "rss" }
+ { :controller => "changeset_comments", :action => "index", :id => "1", :format => "rss" }
)
assert_routing(
{ :path => "/history/comments/feed", :method => :get },
- { :controller => "changeset_comments", :action => "comments_feed", :format => "rss" }
+ { :controller => "changeset_comments", :action => "index", :format => "rss" }
)
end
##
# test hide comment fail
- def test_hide_comment_fail
+ def test_destroy_comment_fail
# unauthorized
comment = create(:changeset_comment)
assert_equal true, comment.visible
- post :hide_comment, :params => { :id => comment.id }
+ post :destroy, :params => { :id => comment.id }
assert_response :unauthorized
assert_equal true, comment.reload.visible
basic_authorization create(:user).email, "test"
# not a moderator
- post :hide_comment, :params => { :id => comment.id }
+ post :destroy, :params => { :id => comment.id }
assert_response :forbidden
assert_equal true, comment.reload.visible
basic_authorization create(:moderator_user).email, "test"
# bad comment id
- post :hide_comment, :params => { :id => 999111 }
+ post :destroy, :params => { :id => 999111 }
assert_response :not_found
assert_equal true, comment.reload.visible
end
basic_authorization create(:moderator_user).email, "test"
- post :hide_comment, :params => { :id => comment.id }
+ post :destroy, :params => { :id => comment.id }
assert_response :success
assert_equal false, comment.reload.visible
end
##
# test unhide comment fail
- def test_unhide_comment_fail
+ def test_restore_comment_fail
# unauthorized
comment = create(:changeset_comment, :visible => false)
assert_equal false, comment.visible
- post :unhide_comment, :params => { :id => comment.id }
+ post :restore, :params => { :id => comment.id }
assert_response :unauthorized
assert_equal false, comment.reload.visible
basic_authorization create(:user).email, "test"
# not a moderator
- post :unhide_comment, :params => { :id => comment.id }
+ post :restore, :params => { :id => comment.id }
assert_response :forbidden
assert_equal false, comment.reload.visible
basic_authorization create(:moderator_user).email, "test"
# bad comment id
- post :unhide_comment, :params => { :id => 999111 }
+ post :restore, :params => { :id => 999111 }
assert_response :not_found
assert_equal false, comment.reload.visible
end
basic_authorization create(:moderator_user).email, "test"
- post :unhide_comment, :params => { :id => comment.id }
+ post :restore, :params => { :id => comment.id }
assert_response :success
assert_equal true, comment.reload.visible
end
##
# test comments feed
- def test_comments_feed
+ def test_feed
changeset = create(:changeset, :closed)
create_list(:changeset_comment, 3, :changeset => changeset)
- get :comments_feed, :params => { :format => "rss" }
+ get :index, :params => { :format => "rss" }
assert_response :success
assert_equal "application/rss+xml", @response.content_type
assert_select "rss", :count => 1 do
end
end
- get :comments_feed, :params => { :format => "rss", :limit => 2 }
+ get :index, :params => { :format => "rss", :limit => 2 }
assert_response :success
assert_equal "application/rss+xml", @response.content_type
assert_select "rss", :count => 1 do
end
end
- get :comments_feed, :params => { :id => changeset.id, :format => "rss" }
+ get :index, :params => { :id => changeset.id, :format => "rss" }
assert_response :success
assert_equal "application/rss+xml", @response.content_type
assert_select "rss", :count => 1 do
##
# test comments feed
- def test_comments_feed_bad_limit
- get :comments_feed, :params => { :format => "rss", :limit => 0 }
+ def test_feed_bad_limit
+ get :index, :params => { :format => "rss", :limit => 0 }
assert_response :bad_request
- get :comments_feed, :params => { :format => "rss", :limit => 100001 }
+ get :index, :params => { :format => "rss", :limit => 100001 }
assert_response :bad_request
end
end