Commit Graph

14 Commits

Author SHA1 Message Date
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
Peter Leitzen 7b87ed1499 Cleanup usages of `JSON.parse` in specs
Prefer `json_response` where applicable.
2019-07-16 08:03:49 +00:00
Luke Duncalfe ba377e91e1 Authorize access before serving project template
Previously, if a user was a guest member of a private project, they
could access the merge request template as we were not checking
permission-levels of the user.

When a issue template is asked for, the user must have :read_issue for
the project; or :read_merge_request when a merge request template is
asked for.

We also now rescue_from FileNotFoundError and handle as 404. This is
because RepoTemplateFinder can raise a FileNotFoundError exception,
which Rails previously handled as a 500.

Handling these in a way that is consistent with
ActiveRecord::RecordNotFound exceptions, within controllers that
inherit from Projects::ApplicationController at least, and returning a
404.

https://gitlab.com/gitlab-org/gitlab-ce/issues/54943
2019-06-11 08:21:04 +12:00
gfyoung 93a44e135b Add some frozen string to spec/**/*.rb
Adds frozen string to the following:

* spec/bin/**/*.rb
* spec/config/**/*.rb
* spec/controllers/**/*.rb

xref https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-04-15 10:17:05 +00:00
blackst0ne b44a2c801a Update specs to rails5 format
Updates specs to use new rails5 format.

The old format:
`get :show, { some: params }, { some: headers }`

The new format:
`get :show, params: { some: params }, headers: { some: headers }`
2018-12-19 10:04:31 +11:00
Mark Chao a63bce1a4b Resolve "Rename the `Master` role to `Maintainer`" Backend 2018-07-11 14:36:08 +00:00
blackst0ne 27c95364b5 Replace '.team << [user, role]' with 'add_role(user)' in specs 2017-12-22 19:18:28 +11:00
Douwe Maan faa2e2df8f Rename commit_file, commit_dir and remove_file and update specs 2017-02-24 09:55:01 -06:00
Douwe Maan ad640bc5f9 Use Namespace#full_path instead of #path where appropriate 2017-02-23 17:55:01 -06:00
Lin Jen-Shin 406dfd6e0f Merge remote-tracking branch 'upstream/master' into fix-git-hooks-when-creating-file
* upstream/master:
  Ensure we have a project with a repo in GitlabMarkdownHelper specs
  Revert "Make sure TraceReader uses Encoding.default_external"
  Make sure TraceReader uses Encoding.default_external
  Update CONTRIBUTING.md after merging "up-for-grabs" and "Accepting Merge Requests" [ci skip]
  Use `:empty_project` where possible in finder specs
  Use `empty_project` where possible in controller specs
  Use `:empty_project` where possible in helper specs
  Don’t count tasks that are not defined as list items correctly
  Use a project factory with a repository where necessary
  Use `:empty_project` where possible throughout spec/lib
  Use hashrocket for dasherized attribute
  Remove markdown file extension and add anchor to link
  Fixed builds info link on project settings page
  Factories with a project association use `:empty_project` by default
  Update enviroments.md the example for deleting an environment is missing the "s" in environments. curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/1/environments/1"  wil 404
2017-01-26 22:19:50 +08:00
Robert Speicher 4642ca6686 Use `empty_project` where possible in controller specs 2017-01-25 17:14:38 -05:00
Lin Jen-Shin 07b9b80a88 Fix tests to use the new API 2016-12-08 19:11:52 +08:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Felipe Artur 2872672945 Load issues and merge requests templates from repository 2016-08-16 15:50:17 -03:00