From 28befcb5d47c2e3d3e307e96e9491cddf9cad4a2 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 21 Dec 2016 21:21:39 +0800 Subject: [PATCH] Fix specs. --- spec/integration/groups_spec.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spec/integration/groups_spec.rb b/spec/integration/groups_spec.rb index ae88d609d23..57cab61253d 100644 --- a/spec/integration/groups_spec.rb +++ b/spec/integration/groups_spec.rb @@ -23,7 +23,7 @@ describe "Groups" do group_ids = response_body["groups"].map { |g| g["id"] } - expect(response_body["groups"].map { |g| g['is_group_user'] }).to eq([nil]) + expect(response_body["extras"]["group_user_ids"]).to eq([]) expect(group_ids).to include(other_group.id) expect(group_ids).to_not include(group.id) expect(response_body["load_more_groups"]).to eq("/groups?page=1") @@ -32,7 +32,9 @@ describe "Groups" do context 'viewing as an admin' do it 'should display automatic groups' do - sign_in(Fabricate(:admin)) + admin = Fabricate(:admin) + sign_in(admin) + group.add(admin) get "/groups.json" @@ -42,7 +44,7 @@ describe "Groups" do group_ids = response_body["groups"].map { |g| g["id"] } - expect(response_body["groups"].first['is_group_user']).to eq(false) + expect(response_body["extras"]["group_user_ids"]).to eq([group.id]) expect(group_ids).to include(group.id, other_group.id) expect(response_body["load_more_groups"]).to eq("/groups?page=1") expect(response_body["total_rows_groups"]).to eq(10)