# frozen_string_literal: true RSpec.describe BasicGroupSerializer do subject(:serializer) { described_class.new(group, scope: guardian, root: false) } let(:guardian) { Guardian.new } fab!(:group) { Fabricate(:group) } describe "#display_name" do describe "automatic group" do let(:group) { Group.find(1) } it "should include the display name" do expect(serializer.display_name).to eq(I18n.t("groups.default_names.admins")) end end describe "normal group" do fab!(:group) { Fabricate(:group) } it "should not include the display name" do expect(serializer.display_name).to eq(nil) end end end describe "#bio_raw" do subject(:serializer) do described_class.new(group, scope: guardian, root: false, owner_group_ids: [group.id]) end fab!(:group) { Fabricate(:group, bio_raw: "testing :slightly_smiling_face:") } describe "group owner" do it "should include bio_raw" do expect(serializer.as_json[:bio_raw]).to eq("testing :slightly_smiling_face:") expect(serializer.as_json[:bio_excerpt]).to start_with("testing