Commit b9c363e2 authored by Michał "rysiek" Woźniak's avatar Michał "rysiek" Woźniak 🔒

trying to get tests to work for signed e-mails and deliver_selfsent

parent f02b5665
Pipeline #31525 failed with stages
in 10 minutes and 13 seconds
......@@ -745,9 +745,10 @@ describe Schleuder::List do
it "sends the message to all subscribers including the sender, if deliver_selfsent is true" do
list = create(:list, send_encrypted_only: false, deliver_selfsent: true)
sub, msgs = list.subscribe("admin@example.org", nil, true)
sub, msgs = list.subscribe("user1@example.org")
sub, msgs = list.subscribe("user2@example.org")
key_material = File.read("spec/fixtures/default_list_key.txt")
sub, msgs = list.subscribe("admin@example.org", nil, true, true, key_material)
key_material = File.read("spec/fixtures/example_key.txt")
sub, msgs = list.subscribe("user1@example.org", nil, false, true, key_material)
mail = Mail.new
mail.to = list.email
mail.from = 'user1@example.org'
......@@ -759,23 +760,22 @@ describe Schleuder::List do
recipients = messages.map { |m| m.to.first }.sort
expect(list.deliver_selfsent).to be(true)
expect(messages.size).to be(3)
expect(recipients).to eql(['admin@example.org', 'user1@example.org', 'user2@example.org'])
expect(messages[0].parts.first.parts.last.body.to_s).to eql("Some content")
expect(messages.size).to be(2)
expect(recipients).to eql(['admin@example.org', 'user1@example.org'])
expect(messages[0].parts.last.body.to_s).to include("-----BEGIN PGP MESSAGE-----")
expect(messages[0].subject).to eql("Something")
expect(messages[1].parts.first.parts.last.body.to_s).to eql("Some content")
expect(messages[1].parts.last.body.to_s).to include("-----BEGIN PGP MESSAGE-----")
expect(messages[1].subject).to eql("Something")
expect(messages[2].parts.first.parts.last.body.to_s).to eql("Some content")
expect(messages[2].subject).to eql("Something")
teardown_list_and_mailer(list)
end
it "sends the message to all subscribers but not the sender, if deliver_selfsent is false" do
list = create(:list, send_encrypted_only: false, deliver_selfsent: false)
sub, msgs = list.subscribe("admin@example.org", nil, true)
sub, msgs = list.subscribe("user1@example.org")
sub, msgs = list.subscribe("user2@example.org")
key_material = File.read("spec/fixtures/default_list_key.txt")
sub, msgs = list.subscribe("admin@example.org", nil, true, true, key_material)
key_material = File.read("spec/fixtures/example_key.txt")
sub, msgs = list.subscribe("user1@example.org", nil, false, true, key_material)
mail = Mail.new
mail.to = list.email
mail.from = 'user1@example.org'
......@@ -787,12 +787,10 @@ describe Schleuder::List do
recipients = messages.map { |m| m.to.first }.sort
expect(list.deliver_selfsent).to be(false)
expect(messages.size).to be(2)
expect(recipients).to eql(['admin@example.org', 'user2@example.org'])
expect(messages[0].parts.first.parts.last.body.to_s).to eql("Some content")
expect(messages.size).to be(1)
expect(recipients).to eql(['admin@example.org'])
expect(messages[0].parts.last.body.to_s).to include("-----BEGIN PGP MESSAGE-----")
expect(messages[0].subject).to eql("Something")
expect(messages[1].parts.first.parts.last.body.to_s).to eql("Some content")
expect(messages[1].subject).to eql("Something")
teardown_list_and_mailer(list)
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment