diff options
author | James Lopez <james@jameslopez.es> | 2017-07-05 14:59:19 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-07-06 15:27:48 +0200 |
commit | 383138af617135dd72ca7016c1156c0cd2e6cb25 (patch) | |
tree | e51c884974207270ae943ab7d6d425cc3a7f976c /spec/requests/api | |
parent | bb918a2fd98136c232baa34104c357f3716f8842 (diff) | |
download | gitlab-ce-383138af617135dd72ca7016c1156c0cd2e6cb25.tar.gz |
add issues spec and user agent details to entities
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/issues_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/requests/api/issues_spec.rb b/spec/requests/api/issues_spec.rb index 79cac721202..2fb9c3ee3ad 100644 --- a/spec/requests/api/issues_spec.rb +++ b/spec/requests/api/issues_spec.rb @@ -1462,6 +1462,25 @@ describe API::Issues do end end + describe "GET /projects/:id/issues/:issue_iid/user_agent_detail" do + let(:user_agent_detail) { create(:user_agent_detail, subject: issue) } + + it 'exposes known attributes' do + get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", admin) + + expect(response).to have_http_status(200) + expect(json_response['user_agent']).to eq(user_agent_detail.user_agent) + expect(json_response['ip_address']).to eq(user_agent_detail.ip_address) + expect(json_response['submitted']).to be false + end + + it "returns unautorized for non-admin users" do + get api("/projects/#{project.id}/issues/#{issue.iid}/user_agent_detail", user) + + expect(response).to have_http_status(403) + end + end + def expect_paginated_array_response(size: nil) expect(response).to have_http_status(200) expect(response).to include_pagination_headers |