]> git.openstreetmap.org Git - rails.git/blob - test/lib/spam_scorer_test.rb
Move into submodule ahead of new type of scorer
[rails.git] / test / lib / spam_scorer_test.rb
1 # frozen_string_literal: true
2
3 require "test_helper"
4
5 class SpamScorerTest < ActiveSupport::TestCase
6   def test_html_spam_score
7     r = RichText.new("html", "foo <a href='http://example.com/'>bar</a> baz")
8     scorer = SpamScorer.new_from_rich_text(r)
9     assert_equal 55, scorer.score.round
10   end
11
12   def test_markdown_spam_score
13     r = RichText.new("markdown", "foo [bar](http://example.com/) baz")
14     scorer = SpamScorer.new_from_rich_text(r)
15     assert_equal 50, scorer.score.round
16   end
17
18   def test_text_spam_score
19     r = RichText.new("text", "foo http://example.com/ bar")
20     scorer = SpamScorer.new_from_rich_text(r)
21     assert_equal 141, scorer.score.round
22   end
23 end