Commit graph

14 commits

Author SHA1 Message Date
Douwe Maan
294fa6fcdc Remove authentication using user.private_token 2017-11-02 11:39:02 +01:00
Robert Schilling
8ecd9b574f Remove leftover API helper for removed CI API 2017-08-24 18:07:45 +02:00
Timothy Andrew
0ff1d16192 Test OAuth token scope verification in the API::Users endpoint 2017-06-28 07:17:13 +00:00
Timothy Andrew
157c05f49d Test /users endpoints for the read_user scope.
- Test `GET` endpoints to check that the scope is allowed.
- Test `POST` endpoints to check that the scope is disallowed.
- Test both `v3` and `v4` endpoints.
2017-06-28 07:17:13 +00:00
Timothy Andrew
6f1922500b Initial attempt at refactoring API scope declarations.
- Declaring an endpoint's scopes in a `before` block has proved to be
  unreliable. For example, if we're accessing the `API::Users` endpoint - code
  in a `before` block in `API::API` wouldn't be able to see the scopes set in
  `API::Users` since the `API::API` `before` block runs first.

- This commit moves these declarations to the class level, since they don't need
  to change once set.
2017-06-28 07:17:13 +00:00
Rémy Coutable
5f7592d538 Implement json_response as a let variable
This is not a good idea to memoize `json_response` using an instance
variable because `rspec-retry` doesn't clear instance variables on
retries, only `let` variables.

This will avoid issues where retries would fail on a different line that
the original failure, blurrying what's the real failure.

Also, automatically add api: true to specs under
/spec/requests/(ci/)?api/, and include JsonHelpers in controller, request
and API specs.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-13 17:33:17 +01:00
Oswaldo Ferreira
cadef80275 Remain V3 endpoint unchanged 2017-01-30 17:00:21 -02:00
Grzegorz Bizon
07be594378 Enable Style/MultilineTernaryOperator rubocop cop
Avoid multi-line ?: (the ternary operator). Use if/unless instead.

See #17478
2016-07-20 14:24:39 +02:00
Valery Sizov
910bf96ec3 fix specs. Stage 2 2015-09-14 18:14:17 +03:00
Robert Speicher
1f9a2ab7c9 Memoize result of JSON.parse in json_response
This might see a minor speedup in test cases that call this method many
times.
2015-06-10 01:31:27 -04:00
Dmitriy Zaporozhets
634cbd7138 Refactor API classes. So api classes like Gitlab::Issues become API::Issues 2013-05-14 15:33:31 +03:00
Nihad Abbasov
968c09ae91 API version returns last version set
* fixed in grape v0.2.2
2012-12-01 02:03:51 -08:00
Robert Speicher
b2a5344a2d Add a simple api method to ApiHelpers, replacing api_prefix
See docs for usage
2012-08-25 14:19:15 -04:00
Robert Speicher
fba174e9bc Cleanup spec/support folder and spec/spec_helper
Changes:
* Move spec/monkeypatch to spec/support
* Remove unused support/shared_examples
* Move support/api to support/api_helpers to match module name
* Move support/login to support/login_helpers to match module name
* Move API specs to requests/api (convention over configuration)
* Remove unused support/js_patch
* Simplify login_as helper
* Move DatabaseCleaner stuff to its own support file
* Remove unnecessary configuration and requires from spec_helper
2012-08-25 14:19:15 -04:00