Skip to content

A platform for community discussion. Free, open, simple.

DEV: amend test for anonymous handling to use real data

Sam Saffron1efed6e5276e
diff --git a/plugins/discourse-narrative-bot/spec/user_spec.rb b/plugins/discourse-narrative-bot/spec/user_spec.rb
index 8ddf472c372..f73c291f410 100644
--- a/plugins/discourse-narrative-bot/spec/user_spec.rb
+++ b/plugins/discourse-narrative-bot/spec/user_spec.rb
@@ -109,12 +109,17 @@ describe User do
end
context 'when user is anonymous?' do
- let(:anonymous_user) { Fabricate(:anonymous) }
-
- it 'should not initiate the bot' do
+ before do
SiteSetting.allow_anonymous_posting = true
+ end
+
+ it 'should initiate bot for real user only' do
+
+ user = Fabricate(:user, trust_level: 1)
+ shadow = AnonymousShadowCreator.get(user)
- expect { anonymous_user }.to_not change { Post.count }
+ expect(TopicAllowedUser.where(user_id: shadow.id).count).to eq(0)
+ expect(TopicAllowedUser.where(user_id: user.id).count).to eq(1)
end
end