mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
Merge pull request #9725 from vsmay98/9468-hide-all-references-hub-from-producers-profile
[Shopfront] Hide hub with "hide all references" setup in producers profiles
This commit is contained in:
@@ -63,7 +63,7 @@ module Api
|
||||
|
||||
def hubs
|
||||
ActiveModel::ArraySerializer.new(
|
||||
enterprise.distributors, each_serializer: Api::EnterpriseThinSerializer
|
||||
enterprise.distributors.not_hidden, each_serializer: Api::EnterpriseThinSerializer
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user