FIX: Editing a topic's title should be rate limited too.

This commit is contained in:
Robin Ward
2014-10-07 16:46:01 -04:00
parent 11b52d1334
commit 2fbfc9dffa
2 changed files with 7 additions and 0 deletions

View File

@ -770,6 +770,12 @@ describe TopicsController do
expect(response).not_to be_success
end
it "returns errors when the rate limit is exceeded" do
EditRateLimiter.any_instance.expects(:performed!).raises(RateLimiter::LimitExceeded.new(60))
xhr :put, :update, topic_id: @topic.id, slug: @topic.title, title: 'This is a new title for the topic'
response.should_not be_success
end
it "returns errors with invalid categories" do
Topic.any_instance.expects(:change_category_to_id).returns(false)
xhr :put, :update, topic_id: @topic.id, slug: @topic.title