2022-07-28 16:16:33 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe BasicReviewableUserSerializer do
|
2023-06-21 22:00:19 +08:00
|
|
|
subject(:serializer) { described_class.new(reviewable, root: false).as_json }
|
2022-07-28 16:16:33 +08:00
|
|
|
|
2023-06-21 22:00:19 +08:00
|
|
|
fab!(:user) { Fabricate(:user) }
|
2022-07-28 16:16:33 +08:00
|
|
|
fab!(:reviewable) do
|
|
|
|
ReviewableUser.needs_review!(
|
|
|
|
target: user,
|
|
|
|
created_by: Discourse.system_user,
|
|
|
|
payload: {
|
|
|
|
username: user.username,
|
|
|
|
name: user.name,
|
|
|
|
email: user.email,
|
|
|
|
bio: "blah whatever",
|
|
|
|
website: "ff.website.com",
|
|
|
|
},
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
include_examples "basic reviewable attributes"
|
|
|
|
|
|
|
|
describe "#username" do
|
|
|
|
it "equals the username in the reviewable's payload" do
|
2023-06-21 22:00:19 +08:00
|
|
|
expect(serializer[:username]).to eq(user.username)
|
2022-07-28 16:16:33 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|