Commit graph

10 commits

Author SHA1 Message Date
GitLab Bot
7bb7a8d529 Add latest changes from gitlab-org/gitlab@master 2019-09-25 03:06:21 +00:00
Stan Hu
680f437715 Fix snippets API not working with visibility level
When a restricted visibility level of `private` is set in the instance,
creating a snippet with the `visibility` level would always fail.
This happened because:

1. `params[:visibility]` was a string (e.g. "public")
2. `CreateSnippetService` and `UpdateSnippetService` only looked
   at `params[:visibility_level]`, which was `nil`.

To fix this, we:

1. Make `CreateSnippetService` look at the newly-built
   `snippet.visibility_level`, since the right value is assigned by the
   `VisibilityLevel#visibility=` method.
2. Modify `UpdateSnippetService` to handle both `visibility_level` and
`visibility` parameters.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/66050
2019-08-28 22:49:58 -07:00
Mark Chao
4a6f959ab8 Record usage on snippet usage
Generalize wiki page counter for other page types to extend to.
2019-08-08 13:18:57 +00:00
Thong Kuah
85b29c1c2f Add frozen_string_literal to spec/services
Probably useful as we often move these files to "new" files.
2019-04-12 10:14:54 +12:00
Rémy Coutable
ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
tiagonbotelho
1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Douwe Maan
19aa20d528 Fix more specs 2016-03-20 23:09:33 +01:00
Douwe Maan
a2cfb44157 Tag service specs 2015-12-09 11:55:49 +01:00
Robert Speicher
cf7c57aaf5 Use stub_application_setting in a few more specs
These specs also failed when run by themselves before this change, so
we've likely got some kind of cross-test contamination going on.
2015-07-06 22:39:56 -04:00
Vinnie Okada
13e9f4f334 Add tests for snippet services
Add Rspec tests for the new UpdateSnippetService and
CreateSnippetService classes.
2015-03-14 10:33:02 -06:00