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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
275a46c5
Commit
275a46c5
authored
Mar 02, 2017
by
http://jneen.net/
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spec the new behavior of .class_for
and more robustly spec the ancestor behavior
parent
f1d3a92b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
spec/policies/base_policy_spec.rb
spec/policies/base_policy_spec.rb
+6
-4
No files found.
spec/policies/base_policy_spec.rb
View file @
275a46c5
require
'spec_helper'
describe
BasePolicy
,
models:
true
do
let
(
:build
)
{
Ci
::
Build
.
new
}
describe
'.class_for'
do
it
'detects policy class based on the subject ancestors'
do
expect
(
described_class
.
class_for
(
build
)).
to
eq
(
Ci
::
Build
Policy
)
expect
(
described_class
.
class_for
(
GenericCommitStatus
.
new
)).
to
eq
(
CommitStatus
Policy
)
end
it
'detects policy class for a presented subject'
do
presentee
=
Ci
::
BuildPresenter
.
new
(
build
)
presentee
=
Ci
::
BuildPresenter
.
new
(
Ci
::
Build
.
new
)
expect
(
described_class
.
class_for
(
presentee
)).
to
eq
(
Ci
::
BuildPolicy
)
end
it
'uses GlobalPolicy when :global is given'
do
expect
(
described_class
.
class_for
(
:global
)).
to
eq
(
GlobalPolicy
)
end
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