summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-12 14:58:44 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 22:49:41 +0200
commit3e6dd7d88daaac2dbafc234753942086e0ba0403 (patch)
treee80888fc0580c78e71db4b0b57c4b088c9c64d0c /spec/controllers
parent960559aa6889a0b5ac1d46b84b7f7977a57d50ca (diff)
downloadgitlab-ce-3e6dd7d88daaac2dbafc234753942086e0ba0403.tar.gz
Use same response-body in groups-dashboard as we do for group-home
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/dashboard/groups_controller_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb
new file mode 100644
index 00000000000..89a16c233d8
--- /dev/null
+++ b/spec/controllers/dashboard/groups_controller_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe Dashboard::GroupsController do
+ let(:group) { create(:group, :public) }
+ let(:user) { create(:user) }
+
+ before do
+ group.add_owner(user)
+ sign_in(user)
+ end
+
+ describe 'GET #index' do
+ it 'shows child groups as json' do
+ get :index, format: :json
+
+ expect(json_response.first['id']).to eq(group.id)
+ end
+
+ it 'filters groups' do
+ other_group = create(:group, name: 'filter')
+ other_group.add_owner(user)
+
+ get :index, filter: 'filt', format: :json
+ all_ids = json_response.map { |group_json| group_json['id'] }
+
+ expect(all_ids).to contain_exactly(other_group.id)
+ end
+ end
+end