aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
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