diff options
author | Jarka Košanová <jarka@gitlab.com> | 2019-07-11 12:53:08 +0300 |
---|---|---|
committer | Jarka Košanová <jarka@gitlab.com> | 2019-07-16 11:04:54 +0300 |
commit | c8e24280c55b5678bc2c01435ab26781bbbb6cd2 (patch) | |
tree | 73c001626e005b7df622db6a329158376567697d /spec/requests | |
parent | 00b944afb88d1e52add0724c7d5cc6b62505ec32 (diff) |
Simplify factories for services
- use predefined factories when creating
projects with services
- remove unnecessary arguments
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/services_spec.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/requests/api/services_spec.rb b/spec/requests/api/services_spec.rb index 3f79e332b90..91cb8760a04 100644 --- a/spec/requests/api/services_spec.rb +++ b/spec/requests/api/services_spec.rb @@ -85,9 +85,7 @@ describe API::Services do include_context service # inject some properties into the service - before do - initialize_service(service) - end + let!(:initialized_service) { initialize_service(service) } it 'returns authentication error when unauthenticated' do get api("/projects/#{project.id}/services/#{dashed_service}") @@ -108,6 +106,15 @@ describe API::Services do expect(json_response['properties'].keys).to match_array(service_instance.api_field_names) end + it "returns empty hash if properties are empty" do + # deprecated services are not valid for update + initialized_service.update_attribute(:properties, {}) + get api("/projects/#{project.id}/services/#{dashed_service}", user) + + expect(response).to have_gitlab_http_status(200) + expect(json_response['properties'].keys).to be_empty + end + it "returns error when authenticated but not a project owner" do project.add_developer(user2) get api("/projects/#{project.id}/services/#{dashed_service}", user2) |