add specs to not include hidden hubs

This commit is contained in:
Vishal Jain
2022-10-03 21:35:47 +05:30
committed by Konrad
parent 6ead127b5c
commit b582b61414

View File

@@ -50,6 +50,15 @@ describe Api::EnterpriseShopfrontSerializer do
expect(serializer.serializable_hash[:hubs].to_json).to match hub.name
end
context 'when hub is marked as hidden' do
before { hub.update_column(:visible, 'hidden') }
it 'serializes an array of public hubs' do
expect(serializer.serializable_hash[:hubs]).to be_a ActiveModel::ArraySerializer
expect(serializer.serializable_hash[:hubs].to_json).not_to match hub.name
end
end
it "serializes an array of producers that are public or linked by links" do
expect(serializer.serializable_hash[:producers]).to be_a ActiveModel::ArraySerializer
expect(serializer.serializable_hash[:producers].to_json).to match producer.name