diff options
author | jubianchi <contact@jubianchi.fr> | 2015-01-30 12:46:08 +0300 |
---|---|---|
committer | jubianchi <contact@jubianchi.fr> | 2015-02-03 15:42:38 +0300 |
commit | 4e97f26649a7756bef843fca74e3c58eadd117e1 (patch) | |
tree | 3df8a8967811007ca81c863d09e2767799479829 /spec/requests/api/groups_spec.rb | |
parent | a073e00ab41b5fa4979b021b55cf184ffc104fb9 (diff) |
Acces groups with their path in API
Diffstat (limited to 'spec/requests/api/groups_spec.rb')
-rw-r--r-- | spec/requests/api/groups_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/requests/api/groups_spec.rb b/spec/requests/api/groups_spec.rb index 95f82463367..8465d765294 100644 --- a/spec/requests/api/groups_spec.rb +++ b/spec/requests/api/groups_spec.rb @@ -73,6 +73,24 @@ describe API::API, api: true do response.status.should == 404 end end + + context 'when using group path in URL' do + it 'should return any existing group' do + get api("/groups/#{group1.path}", admin) + response.status.should == 200 + json_response['name'] == group2.name + end + + it 'should not return a non existing group' do + get api('/groups/unknown', admin) + response.status.should == 404 + end + + it 'should not return a group not attached to user1' do + get api("/groups/#{group2.path}", user1) + response.status.should == 403 + end + end end describe "POST /groups" do |