mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 10:54:22 +08:00
30 lines
723 B
Ruby
30 lines
723 B
Ruby
|
require 'spec_helper'
|
||
|
|
||
|
describe AnonymousShadowCreator do
|
||
|
|
||
|
it "returns no shadow by default" do
|
||
|
AnonymousShadowCreator.get(Fabricate.build(:user)).should == nil
|
||
|
end
|
||
|
|
||
|
it "returns no shadow if trust level is not met" do
|
||
|
SiteSetting.allow_anonymous_posting = true
|
||
|
AnonymousShadowCreator.get(Fabricate.build(:user, trust_level: 0)).should == nil
|
||
|
end
|
||
|
|
||
|
it "returns a shadow for a legit user" do
|
||
|
SiteSetting.allow_anonymous_posting = true
|
||
|
user = Fabricate(:user, trust_level: 3)
|
||
|
|
||
|
shadow = AnonymousShadowCreator.get(user)
|
||
|
shadow2 = AnonymousShadowCreator.get(user)
|
||
|
|
||
|
shadow.id.should == shadow2.id
|
||
|
|
||
|
shadow.trust_level.should == 1
|
||
|
|
||
|
shadow.username.should == "anonymous"
|
||
|
|
||
|
end
|
||
|
|
||
|
end
|