mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:39:30 +08:00
DEV: Remove remaining hardcoded ids (#18735)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
RSpec.describe UserCardSerializer do
|
||||
context "with a TL0 user seen as anonymous" do
|
||||
let(:user) { Fabricate.build(:user, trust_level: 0, user_profile: Fabricate.build(:user_profile)) }
|
||||
let(:user) { Fabricate(:user, trust_level: 0) }
|
||||
let(:serializer) { described_class.new(user, scope: Guardian.new, root: false) }
|
||||
let(:json) { serializer.as_json }
|
||||
|
||||
@ -14,12 +14,9 @@ RSpec.describe UserCardSerializer do
|
||||
|
||||
context "as current user" do
|
||||
it "serializes emails correctly" do
|
||||
user = Fabricate.build(:user,
|
||||
id: 1,
|
||||
user_profile: Fabricate.build(:user_profile),
|
||||
user_option: UserOption.new(dynamic_favicon: true),
|
||||
user_stat: UserStat.new
|
||||
)
|
||||
user = Fabricate(:user)
|
||||
user.user_option.update(dynamic_favicon: true)
|
||||
|
||||
json = described_class.new(user, scope: Guardian.new(user), root: false).as_json
|
||||
expect(json[:secondary_emails]).to eq([])
|
||||
expect(json[:unconfirmed_emails]).to eq([])
|
||||
@ -29,6 +26,7 @@ RSpec.describe UserCardSerializer do
|
||||
context "as different user" do
|
||||
let(:user) { Fabricate(:user, trust_level: 0) }
|
||||
let(:user2) { Fabricate(:user, trust_level: 1) }
|
||||
|
||||
it "does not serialize emails" do
|
||||
json = described_class.new(user, scope: Guardian.new(user2), root: false).as_json
|
||||
expect(json[:secondary_emails]).to be_nil
|
||||
|
Reference in New Issue
Block a user