summaryrefslogtreecommitdiff
path: root/spec/controllers/dashboard/groups_controller_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/controllers/dashboard/groups_controller_spec.rb')
-rw-r--r--spec/controllers/dashboard/groups_controller_spec.rb27
1 files changed, 27 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..23bdaf6a789
--- /dev/null
+++ b/spec/controllers/dashboard/groups_controller_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe Dashboard::GroupsController do
+ let(:user) { create(:user) }
+
+ before do
+ sign_in(user)
+ end
+
+ describe 'GET #index' do
+ it_behaves_like 'project tree json', :index do
+ # No extra params required for this request
+ let(:group) { nil }
+ let(:request_params) { { id: group.to_param } }
+
+ it 'does not include public groups that the user is not a member of' do
+ public_group = create(:group, :public)
+
+ get :index, id: group.to_param, format: :json
+
+ group_ids = json_response.map { |group_json| group_json['id'] }
+
+ expect(group_ids).not_to include(public_group.id)
+ end
+ end
+ end
+end