From fcdfb62d0f9ca9773da57e20286b8623c2c866f5 Mon Sep 17 00:00:00 2001 From: mms Date: Mon, 25 Nov 2024 00:11:05 +0100 Subject: feat: mailig list rule --- spec/filters/mailing_list_filter_spec.rb | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 spec/filters/mailing_list_filter_spec.rb (limited to 'spec') 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 ')) + .to eq('list-header.nisto.com') + } + + it { + expect(subject.list_id_from_header('')) + .to eq('commonspace-users.list-id.within.com') + } + + it { + expect(subject + .list_id_from_header("\"Lena's Personal Joke List\" +")) + .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('')) + .to eq('da39efc25c530ad145d41b86f7420c3b.052000.localhost') + } +end -- cgit v1.2.3