mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 10:20:58 -06:00
Add some clarifying specs around new-topic-creating emails work
Strangers get to create new topics (if the appropriate tickbox is ticked) but low-TL existing users don't. That might seem a bit backwards, but the tickbox says 'strangers', not 'everyone'.
This commit is contained in:
parent
b15f6bd211
commit
7a1e99dacb
@ -435,4 +435,25 @@ describe Email::Receiver do
|
||||
|
||||
end
|
||||
|
||||
context "new topic in a category that allows strangers" do
|
||||
|
||||
let!(:category) { Fabricate(:category, email_in: "category@bar.com|category@foo.com", email_in_allow_strangers: true) }
|
||||
|
||||
it "lets an email in from a stranger" do
|
||||
expect { process(:new_user) }.to change(Topic, :count)
|
||||
end
|
||||
|
||||
it "lets an email in from a high-TL user" do
|
||||
Fabricate(:user, email: "tl4@bar.com", trust_level: TrustLevel[4])
|
||||
expect { process(:tl4_user) }.to change(Topic, :count)
|
||||
end
|
||||
|
||||
it "fails on email from a low-TL user" do
|
||||
SiteSetting.email_in_min_trust = 4
|
||||
Fabricate(:user, email: "tl3@bar.com", trust_level: TrustLevel[3])
|
||||
expect { process(:tl3_user) }.to raise_error(Email::Receiver::InsufficientTrustLevelError)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user