Skip to content

Commit b90b830

Browse files
committed
Add a test removed mistakenly
1 parent ba72e87 commit b90b830

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

test/controllers/pushes_controller_test.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,21 @@ class PushesControllerTest < ActionDispatch::IntegrationTest
280280
assert_nil flash[:notice]
281281
end
282282

283+
test "access is rate limited after five attempts per push" do
284+
@push.update!(passphrase: "secret")
285+
286+
5.times do |i|
287+
post access_push_path(@push), params: {passphrase: "wrong#{i}"}
288+
assert_response :redirect
289+
end
290+
291+
post access_push_path(@push), params: {passphrase: "wrong5"}
292+
293+
assert_response :redirect
294+
assert_redirected_to passphrase_push_path(@push)
295+
assert_match(/Too many passphrase attempts/, flash[:alert])
296+
end
297+
283298
test "notify_emails is rate limited after five bursts per user" do
284299
Rails.cache.clear
285300

0 commit comments

Comments
 (0)