From 40e545dc306cc2e61938e3a1c31425e889e69c1c Mon Sep 17 00:00:00 2001 From: Osama Sayegh Date: Tue, 27 Apr 2021 14:05:45 +0300 Subject: [PATCH] DEV: Improve tag groups test (#12848) --- spec/requests/tag_groups_controller_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/requests/tag_groups_controller_spec.rb b/spec/requests/tag_groups_controller_spec.rb index 885bf5d7812..2524f84d239 100644 --- a/spec/requests/tag_groups_controller_spec.rb +++ b/spec/requests/tag_groups_controller_spec.rb @@ -55,16 +55,17 @@ RSpec.describe TagGroupsController do context 'for anons' do it 'returns the tag group with the associated tag names' do tag_group = tag_group_with_permission(everyone, readonly) - tag_group_with_permission(everyone, readonly) + tag_group2 = tag_group_with_permission(everyone, readonly) get '/tag_groups/filter/search.json' expect(response.status).to eq(200) results = JSON.parse(response.body, symbolize_names: true).fetch(:results) - expect(results.count).to eq(2) - expect(results.first[:name]).to eq(tag_group.name) - expect(results.first[:tag_names]).to contain_exactly(tag.name) + expect(results).to contain_exactly( + { name: tag_group.name, tag_names: [tag.name] }, + { name: tag_group2.name, tag_names: [tag.name] } + ) end it 'returns an empty array if the tag group is private' do