protect against bots with timeouts

This commit is contained in:
2015-10-06 09:16:07 +02:00
parent 99390a5e5a
commit b381cbf066
9 changed files with 56 additions and 2 deletions
+14
View File
@@ -2,6 +2,7 @@ require 'rails_helper'
feature 'Support announcement' do
scenario 'User announces support' do
allow_any_instance_of(SupportersController).to receive(:input_to_fast?).and_return(false)
visit root_path
fill_in 'Vorname', with: 'Christoph'
@@ -18,4 +19,17 @@ feature 'Support announcement' do
expect { click_button 'Unterstützung zusichern' }.to change { Supporter.count }.by(1)
end
scenario 'A bot tries to enter data' do
visit root_path
click_button 'Unterstützung zusichern'
expect(page).to have_content 'Ihre Eingabe war zu schnell.'
# Test twice just to be sure that it's not become an update action
click_button 'Unterstützung zusichern'
expect(page).to have_content 'Ihre Eingabe war zu schnell.'
end
end