Skip to content
Browse files

check for Timeouts when using mollom

  • Loading branch information...
1 parent 577baf8 commit 9cb52ce1040710b828f6485c08cd62cd9961b682 @gerrit gerrit committed Jul 12, 2010
Showing with 6 additions and 1 deletion.
  1. +1 −1 app/models/mollom_spam_filter.rb
  2. +5 −0 spec/models/mollom_spam_filter_spec.rb
View
2 app/models/mollom_spam_filter.rb
@@ -10,7 +10,7 @@ def configured?
def approved?(comment)
(mollom.key_ok? && ham?(comment)) || raise(SpamFilter::Spam)
- rescue Mollom::Error, SpamFilter::Spam
+ rescue Mollom::Error, SpamFilter::Spam, TimeoutError
false
end
View
5 spec/models/mollom_spam_filter_spec.rb
@@ -65,6 +65,11 @@
MollomSpamFilter.should be_approved(@comment)
end
+ it "should not be approved when the API is unreachable" do
+ @mollom.stub!(:check_content).and_raise(TimeoutError)
+ MollomSpamFilter.should_not be_approved(@comment)
+ end
+
it "should cache the Mollom server list after a successful response" do
Rails.cache.should_receive(:write).with('MOLLOM_SERVER_CACHE', anything())
MollomSpamFilter.should be_approved(@comment)

0 comments on commit 9cb52ce

Please sign in to comment.
Something went wrong with that request. Please try again.