aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-25 00:11:05 +0100
committermms <git@sapka.me>2024-11-25 00:11:05 +0100
commitfcdfb62d0f9ca9773da57e20286b8623c2c866f5 (patch)
treee47b0d22548261f8690c3802445eb2ddab062c48 /spec
parentc2623f1aa3638c988026b28f6a4131df6c61e0c6 (diff)
feat: mailig list rule
Diffstat (limited to 'spec')
-rw-r--r--spec/filters/mailing_list_filter_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/filters/mailing_list_filter_spec.rb b/spec/filters/mailing_list_filter_spec.rb
new file mode 100644
index 0000000..613a648
--- /dev/null
+++ b/spec/filters/mailing_list_filter_spec.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require_relative '../../filters/mailing_lists_filter'
+
+RSpec.describe Chotto::MailingListsFilter do
+ let(:subject) { Chotto::MailingListsFilter }
+
+ it {
+ expect(subject.list_id_from_header('List Header Mailing List <list-header.nisto.com>'))
+ .to eq('list-header.nisto.com')
+ }
+
+ it {
+ expect(subject.list_id_from_header('<commonspace-users.list-id.within.com>'))
+ .to eq('commonspace-users.list-id.within.com')
+ }
+
+ it {
+ expect(subject
+ .list_id_from_header("\"Lena's Personal Joke List\" <lenas-jokes.da39efc25c530ad145d41b86f7420c3b.021999.localhost>
+"))
+ .to eq('lenas-jokes.da39efc25c530ad145d41b86f7420c3b.021999.localhost')
+ }
+
+ it {
+ expect(subject.list_id_from_header('"An internal CMU List" <0Jks9449.list-id.cmu.edu>'))
+ .to eq('0Jks9449.list-id.cmu.edu')
+ }
+
+ it {
+ expect(subject.list_id_from_header('<da39efc25c530ad145d41b86f7420c3b.052000.localhost>'))
+ .to eq('da39efc25c530ad145d41b86f7420c3b.052000.localhost')
+ }
+end