ref: master
plugins/anti_spam/test/unit/anti_spam_plugin_test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
require 'test_helper' class AntiSpamPluginTest < ActiveSupport::TestCase class SpammableContent attr_accessor :spam include Spammable def save!; end def environment; Environment.default; end end def setup @spammable = SpammableContent.new @plugin = AntiSpamPlugin.new end attr_accessor :spammable should 'check for spam and mark as spam if server says it is spam' do spammable.expects(:spam?).returns(true) spammable.expects(:save!) @plugin.check_for_spam(spammable) assert spammable.spam end should 'report comment spam' do spammable.expects(:spam!) @plugin.marked_as_spam(spammable) end should 'report comment ham' do spammable.expects(:ham!) @plugin.marked_as_ham(spammable) end end |