Sha256: 0a264547a1115881a80f4258237c24fc71a461c4dea2ce7a96b746ff7f1c5d71
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require File.expand_path('../../../../helper', __FILE__) describe 'Comments::AntiSpam' do behaves_like :capybara spam_comment = 'Hello, you can buy viagra here ' \ '<a href="http://buyviagra.com/">Buy Viagra</a>' yaml_response = <<-YAML.strip defensio-result: api-version: 2.0 status: success message: signature: 1234abc allow: false classification: spam spaminess: 0.9 profanity-match: false YAML stub_request( :post, 'http://api.defensio.com/2.0/users/test/documents.yaml' ).to_return(:body => yaml_response) it 'Fail to use an invalid engine' do should.raise?(ArgumentError) do Comments::AntiSpam.validate(:foobar, nil, nil, nil, spam_comment) end end it 'Validate a spam comment using Defensio' do get_setting(:defensio_key).value = 'test' Comments::AntiSpam.validate(:defensio, nil, nil, nil, spam_comment) \ .should == true end it 'Fail to validate using defensio without an API key' do get_setting(:defensio_key).value = nil should.raise? do Comments::AntiSpam.validate(:defensio, nil, nil, nil, spam_comment) end get_setting(:defensio_key).value = 'test' end WebMock.reset! end
Version data entries
4 entries across 4 versions & 1 rubygems