A platform for community discussion. Free, open, simple.
Improve specs for `TopicQuery#list_group_topics`.
Guo Xiang Tanaa91bd61a7ad
diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rbindex 98f162f77b9..17fc11def98 100644--- a/spec/components/topic_query_spec.rb+++ b/spec/components/topic_query_spec.rb@@ -904,6 +904,8 @@ describe TopicQuery douserend+ let(:user3) { Fabricate(:user) }+let(:private_category) doFabricate(:private_category, group: group)end@@ -916,11 +918,13 @@ describe TopicQuery dolet!(:topic5) { Fabricate(:topic, user: user, visible: false) }let!(:topic6) { Fabricate(:topic, user: user2) }- it 'should return the right list' do+ it 'should return the right lists for anon user' dotopics = TopicQuery.new.list_group_topics(group).topicsexpect(topics).to contain_exactly(topic1, topic2, topic6)+ end+ it 'should retun the right list for users in the same group' dotopics = TopicQuery.new(user).list_group_topics(group).topicsexpect(topics).to contain_exactly(topic1, topic2, topic3, topic6)@@ -929,5 +933,11 @@ describe TopicQuery doexpect(topics).to contain_exactly(topic1, topic2, topic3, topic6)end++ it 'should return the right list for user no in the group' do+ topics = TopicQuery.new(user3).list_group_topics(group).topics++ expect(topics).to contain_exactly(topic1, topic2, topic6)+ endendend