FIX: don't allow blocked user to send emails in

This commit is contained in:
Régis Hanol
2016-02-11 10:39:57 +01:00
parent 5120dcfb3d
commit cad7fc1062
6 changed files with 28 additions and 3 deletions

View File

@@ -43,6 +43,11 @@ describe Email::Receiver do
expect { process(:inactive_sender) }.to raise_error(Email::Receiver::InactiveUserError)
end
it "raises a BlockedUserError when the sender has been blocked" do
Fabricate(:user, email: "blocked@bar.com", blocked: true)
expect { process(:blocked_sender) }.to raise_error(Email::Receiver::BlockedUserError)
end
skip "doesn't raise an InactiveUserError when the sender is staged" do
Fabricate(:user, email: "staged@bar.com", active: false, staged: true)
expect { process(:staged_sender) }.not_to raise_error

View File

@@ -0,0 +1,9 @@
Return-Path: <blocked@bar.com>
From: Foo Bar <blocked@bar.com>
Date: Fri, 15 Jan 2016 00:12:43 +0100
Message-ID: <8@foo.bar.mail>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

View File

@@ -1,7 +1,7 @@
Return-Path: <staged@bar.com>
From: Foo Bar <staged@bar.com>
Date: Fri, 15 Jan 2016 00:12:43 +0100
Message-ID: <9@foo.bar.mail>
Message-ID: <39@foo.bar.mail>
Mime-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit