diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-04 06:10:53 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-04 06:10:53 +0300 |
commit | 982880576eb35b48caf6791687d4f023136cca25 (patch) | |
tree | 0d7df1f676a920a15250f5789c60111d21681cde /spec/requests | |
parent | ff71e5f91c447686ab7bec7407dba0d4738a8807 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/topics_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/requests/api/topics_spec.rb b/spec/requests/api/topics_spec.rb index e711414a895..72221e3fb6a 100644 --- a/spec/requests/api/topics_spec.rb +++ b/spec/requests/api/topics_spec.rb @@ -36,6 +36,22 @@ RSpec.describe API::Topics do expect(json_response[2]['total_projects_count']).to eq(1) end + context 'with without_projects' do + let_it_be(:topic_4) { create(:topic, name: 'unassigned topic', total_projects_count: 0) } + + it 'returns topics without assigned projects' do + get api('/topics'), params: { without_projects: true } + + expect(json_response.map { |t| t['id'] }).to contain_exactly(topic_4.id) + end + + it 'returns topics without assigned projects' do + get api('/topics'), params: { without_projects: false } + + expect(json_response.map { |t| t['id'] }).to contain_exactly(topic_1.id, topic_2.id, topic_3.id, topic_4.id) + end + end + context 'with search' do using RSpec::Parameterized::TableSyntax |