2022-07-28 04:16:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe BasicReviewableUserSerializer do
|
2023-06-21 10:00:19 -04:00
|
|
|
subject(:serializer) { described_class.new(reviewable, root: false).as_json }
|
2022-07-28 04:16:33 -04:00
|
|
|
|
2023-11-09 17:47:59 -05:00
|
|
|
fab!(:user)
|
2022-07-28 04:16:33 -04: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 10:00:19 -04:00
|
|
|
expect(serializer[:username]).to eq(user.username)
|
2022-07-28 04:16:33 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|