diff options
author | Gareth Rees <gareth@mysociety.org> | 2014-03-26 17:00:20 +0000 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2014-03-31 12:22:25 +0100 |
commit | 5d6d21f690e283682b9be74a8f00c501b148856f (patch) | |
tree | 09cb72ef2d8f62bec8bd7ce1fcae24c3b2633f5c /spec/controllers/help_controller_spec.rb | |
parent | b2acdc723ab7f56ca71f19ddcb571468dd5159ef (diff) |
Add honeypot spam protection to contact form
Intercepts the request and redirects to the homepage if the comment
field is filled in on the contact form.
Diffstat (limited to 'spec/controllers/help_controller_spec.rb')
-rw-r--r-- | spec/controllers/help_controller_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/controllers/help_controller_spec.rb b/spec/controllers/help_controller_spec.rb index 8ac10e244..f92323f50 100644 --- a/spec/controllers/help_controller_spec.rb +++ b/spec/controllers/help_controller_spec.rb @@ -58,6 +58,23 @@ describe HelpController do deliveries.clear end + it 'has rudimentary spam protection' do + post :contact, { :contact => { + :name => 'Vinny Vanilli', + :email => 'vinny@localhost', + :subject => 'Why do I have such an ace name?', + :comment => 'I AM A SPAMBOT', + :message => "You really should know!!!\n\nVinny", + }, :submitted_contact_form => 1 + } + + response.should redirect_to(frontpage_path) + + deliveries = ActionMailer::Base.deliveries + deliveries.size.should == 0 + deliveries.clear + end + end end |