2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

TEST: TopicViewItem ip logging test

This commit is contained in:
riking 2018-05-21 18:02:15 -07:00 committed by Sam
parent 94f70c7b5c
commit 13a5e41fca

View file

@ -27,4 +27,14 @@ describe TopicViewItem do
expect(user.user_stat.topics_entered).to eq(1)
end
it "does not log IP address for logged-in users" do
topic = Fabricate(:topic)
user = Fabricate(:user)
add(topic.id, "1.1.1.1", user.id)
expect(TopicViewItem.find_by(topic_id: topic.id, user_id: user.id).ip_address).to eq(nil)
add(topic.id, "1.2.3.4", nil)
expect(TopicViewItem.find_by(topic_id: topic.id, user_id: nil).ip_address).to eq("1.2.3.4")
end
end