summaryrefslogtreecommitdiff
path: root/spec/controllers/dashboard
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-13 17:16:30 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 22:49:41 +0200
commit3a4dc55f2924debcdbb37eb63d8ce57b1358df81 (patch)
tree614d82e8b26b5c2698c564d9e244a86c35d714fe /spec/controllers/dashboard
parent39df53ff0aeac24d390eea52a1df6dfe103a4c14 (diff)
downloadgitlab-ce-3a4dc55f2924debcdbb37eb63d8ce57b1358df81.tar.gz
Reuse the groups tree for explore and dashboard.
Diffstat (limited to 'spec/controllers/dashboard')
-rw-r--r--spec/controllers/dashboard/groups_controller_spec.rb24
1 files changed, 9 insertions, 15 deletions
diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb
index 89a16c233d8..fb9d3efbac0 100644
--- a/spec/controllers/dashboard/groups_controller_spec.rb
+++ b/spec/controllers/dashboard/groups_controller_spec.rb
@@ -1,29 +1,23 @@
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 'renders group trees' do
+ expect(described_class).to include(GroupTree)
+ end
- it 'filters groups' do
- other_group = create(:group, name: 'filter')
- other_group.add_owner(user)
+ it 'only includes projects the user is a member of' do
+ member_of_group = create(:group)
+ member_of_group.add_developer(user)
+ create(:group, :public)
- get :index, filter: 'filt', format: :json
- all_ids = json_response.map { |group_json| group_json['id'] }
+ get :index
- expect(all_ids).to contain_exactly(other_group.id)
- end
+ expect(assigns(:groups)).to contain_exactly(member_of_group)
end
end