gitlab-ce/spec/controllers/projects
Robert Speicher e71cd7a300 Merge branch 'refactor/add-policies' into 'master'
Refactor ability.rb into Policies

## What does this MR do?
Factors out `ability.rb` into a new abstraction - the "policy" (stored in `app/policies`). A policy is a class named `#{class_name}Policy` (looked up automatically as needed) that implements `rules` as follows:

``` ruby
class ThingPolicy < BasePolicy
  def rules
    @user # this is a user to determine abilities for, optionally nil in the anonymous case
    @subject # this is the subject of the ability, guaranteed to be an instance of `Thing`
    can! :some_ability # grant the :some_ability permission
    cannot! :some_ability # ensure that :some_ability is not allowed. this overrides any `can!` that is called before or after
    delegate! @subject.other_thing # merge the abilities (can!) and prohibitions (cannot!) from `@subject.other_thing`
    can? :some_ability # test whether, so far, :some_ability is allowed
  end

  def anonymous_rules
    # optional. if not implemented `rules` is called where `@user` is nil. otherwise this method is called when `@user` is nil.
  end
end
```

See merge request !5796
2016-08-31 20:53:40 +00:00
..
boards Merge branch 'refactor/add-policies' into 'master' 2016-08-31 20:53:40 +00:00
avatars_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
blame_controller_spec.rb
blob_controller_spec.rb Validate presence of essential params for diff rendering 2016-06-24 16:20:53 -05:00
boards_controller_spec.rb remove Ability.abilities 2016-08-30 11:35:06 -07:00
branches_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
commit_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
commits_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
compare_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
discussions_controller_spec.rb Address review feedback 2016-08-16 11:04:26 -05:00
environments_controller_spec.rb Incorporate feedback 2016-07-29 13:54:45 +02:00
find_file_controller_spec.rb
forks_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
group_links_controller_spec.rb Enable RSpec/NotToNot cop and auto-correct offenses 2016-05-24 15:40:29 -04:00
imports_controller_spec.rb
issues_controller_spec.rb Fix external issue tracker "Issues" link leading to 404s 2016-08-25 14:53:17 -07:00
labels_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
merge_requests_controller_spec.rb Improve grammar 2016-08-30 13:05:40 +02:00
milestones_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
notes_controller_spec.rb Address review feedback 2016-08-16 11:04:26 -05:00
project_members_controller_spec.rb adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
protected_branches_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
raw_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
refs_controller_spec.rb
repositories_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
services_controller_spec.rb fixes part1 of files to start using active tense 2016-08-09 15:06:23 +01:00
snippets_controller_spec.rb Use HTTP matchers if possible 2016-06-27 20:10:42 +02:00
tags_controller_spec.rb Show release notes in tag list 2016-07-26 16:31:25 +01:00
templates_controller_spec.rb Load issues and merge requests templates from repository 2016-08-16 15:50:17 -03:00
todo_controller_spec.rb Cache todos pending/done dashboard query counts 2016-07-12 18:57:52 +02:00
tree_controller_spec.rb Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
uploads_controller_spec.rb Get rid of `is_image` in FileUploader 2016-07-19 18:51:09 +02:00