Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b577faf7
Commit
b577faf7
authored
Jul 27, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the module and add a simple test to check
if all methods are also presented in the user.
parent
e3aaa56c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
2 deletions
+15
-2
app/models/deploy_token.rb
app/models/deploy_token.rb
+1
-1
app/policies/concerns/policy_actor.rb
app/policies/concerns/policy_actor.rb
+1
-1
spec/policies/concerns/policy_actor_spec.rb
spec/policies/concerns/policy_actor_spec.rb
+13
-0
No files found.
app/models/deploy_token.rb
View file @
b577faf7
class
DeployToken
<
ActiveRecord
::
Base
class
DeployToken
<
ActiveRecord
::
Base
include
Expirable
include
Expirable
include
TokenAuthenticatable
include
TokenAuthenticatable
include
Policy
Checkable
include
Policy
Actor
add_authentication_token_field
:token
add_authentication_token_field
:token
AVAILABLE_SCOPES
=
%i(read_repository read_registry)
.
freeze
AVAILABLE_SCOPES
=
%i(read_repository read_registry)
.
freeze
...
...
app/policies/concerns/policy_
checkable
.rb
→
app/policies/concerns/policy_
actor
.rb
View file @
b577faf7
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
# Include this module if we want to pass something else than the user to
# Include this module if we want to pass something else than the user to
# check policies. This defines several methods which the policy checker
# check policies. This defines several methods which the policy checker
# would call and check.
# would call and check.
module
Policy
Checkable
module
Policy
Actor
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
def
blocked?
def
blocked?
...
...
spec/policies/concerns/policy_actor_spec.rb
0 → 100644
View file @
b577faf7
# frozen_string_literal: true
require
'spec_helper'
describe
PolicyActor
do
it
'implements all the methods from user'
do
methods
=
subject
.
instance_methods
# User.instance_methods do not return all methods until an instance is
# initialized. So here we just use an instance
expect
(
build
(
:user
).
methods
).
to
include
(
*
methods
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment