mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
3abc542e63
Followup to c03f83bbea
.
The `flair_group_id` parameter is now required to show the flair, and this serializer was missing that detail.
This also fixes a typo in the `include_flair_group_name?` method.
41 lines
922 B
Ruby
41 lines
922 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe PosterSerializer do
|
|
let(:poster) { Fabricate(:user, admin: false, moderator: false) }
|
|
|
|
it "serializes the correct attributes" do
|
|
expect(PosterSerializer.new(poster).attributes.keys).to contain_exactly(
|
|
:trust_level,
|
|
:avatar_template,
|
|
:id,
|
|
:name,
|
|
:username,
|
|
)
|
|
end
|
|
|
|
it "includes group flair attributes when appropriate" do
|
|
group =
|
|
Fabricate(
|
|
:group,
|
|
name: "Groupster",
|
|
flair_bg_color: "#111111",
|
|
flair_color: "#999999",
|
|
flair_icon: "icon",
|
|
)
|
|
groupie = Fabricate(:user, flair_group: group)
|
|
|
|
expect(PosterSerializer.new(groupie).attributes.keys).to contain_exactly(
|
|
:trust_level,
|
|
:avatar_template,
|
|
:id,
|
|
:name,
|
|
:username,
|
|
:flair_bg_color,
|
|
:flair_color,
|
|
:flair_group_id,
|
|
:flair_name,
|
|
:flair_url,
|
|
)
|
|
end
|
|
end
|