mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 22:06:02 +08:00
DEV: Improve tag groups test (#12848)
This commit is contained in:
parent
e29605b79f
commit
40e545dc30
@ -55,16 +55,17 @@ RSpec.describe TagGroupsController do
|
|||||||
context 'for anons' do
|
context 'for anons' do
|
||||||
it 'returns the tag group with the associated tag names' do
|
it 'returns the tag group with the associated tag names' do
|
||||||
tag_group = tag_group_with_permission(everyone, readonly)
|
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'
|
get '/tag_groups/filter/search.json'
|
||||||
expect(response.status).to eq(200)
|
expect(response.status).to eq(200)
|
||||||
|
|
||||||
results = JSON.parse(response.body, symbolize_names: true).fetch(:results)
|
results = JSON.parse(response.body, symbolize_names: true).fetch(:results)
|
||||||
|
|
||||||
expect(results.count).to eq(2)
|
expect(results).to contain_exactly(
|
||||||
expect(results.first[:name]).to eq(tag_group.name)
|
{ name: tag_group.name, tag_names: [tag.name] },
|
||||||
expect(results.first[:tag_names]).to contain_exactly(tag.name)
|
{ name: tag_group2.name, tag_names: [tag.name] }
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns an empty array if the tag group is private' do
|
it 'returns an empty array if the tag group is private' do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user