2022-07-28 03:16:33 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe BasicReviewableUserSerializer do
|
2023-06-21 09:00:19 -05:00
|
|
|
subject(:serializer) { described_class.new(reviewable, root: false).as_json }
|
2022-07-28 03:16:33 -05:00
|
|
|
|
2023-11-09 16:47:59 -06:00
|
|
|
fab!(:user)
|
2022-07-28 03:16:33 -05: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",
|
2023-01-09 05:18:21 -06:00
|
|
|
website: "ff.website.com",
|
|
|
|
},
|
2022-07-28 03:16:33 -05:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
include_examples "basic reviewable attributes"
|
|
|
|
|
|
|
|
describe "#username" do
|
|
|
|
it "equals the username in the reviewable's payload" do
|
2023-06-21 09:00:19 -05:00
|
|
|
expect(serializer[:username]).to eq(user.username)
|
2022-07-28 03:16:33 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|