diff options
author | Felipe Artur <felipefac@gmail.com> | 2016-03-03 16:52:38 -0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2016-03-10 10:38:36 -0300 |
commit | bd59e59d01c5e845c7f7d451feaa1488670f20de (patch) | |
tree | 23011fda4fe88f878f0ec0f4eed86fe1e6fae9b2 /spec/controllers | |
parent | 5551ccd7201ea6b45a2e2721502ba55e8f525d8f (diff) | |
download | gitlab-ce-bd59e59d01c5e845c7f7d451feaa1488670f20de.tar.gz |
Add visibility level icon and a couple of specs
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 938e97298b6..e7ead824d20 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -20,4 +20,42 @@ describe GroupsController do end end end + + describe 'GET show' do + let(:group) { create(:group, visibility_level: 20) } + + it 'checks if group can be read' do + expect(controller).to receive(:authorize_read_group!) + get :show, id: group.path + end + end + + describe 'POST create' do + before { sign_in(create(:user)) } + + it 'checks if group can be created' do + expect(controller).to receive(:authorize_create_group!) + post :create, { group: { name: "any params" } } + end + end + + describe 'DELETE destroy' do + before { sign_in(create(:user)) } + let(:group) { create(:group, visibility_level: 20) } + + it 'checks if group can be deleted' do + expect(controller).to receive(:authorize_admin_group!) + delete :destroy, id: group.path + end + end + + describe 'PUT update' do + before { sign_in(create(:user)) } + let(:group) { create(:group, visibility_level: 20) } + + it 'checks if group can be updated' do + expect(controller).to receive(:authorize_admin_group!) + put :update, id: group.path, group: { name: 'test' } + end + end end |