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
e072a274
Commit
e072a274
authored
Dec 21, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing specs for request aware entity module
[ci skip]
parent
468b47d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
6 deletions
+25
-6
app/serializers/request_aware_entity.rb
app/serializers/request_aware_entity.rb
+3
-6
spec/serializers/request_aware_entity_spec.rb
spec/serializers/request_aware_entity_spec.rb
+22
-0
No files found.
app/serializers/request_aware_entity.rb
View file @
e072a274
...
@@ -2,14 +2,11 @@ module RequestAwareEntity
...
@@ -2,14 +2,11 @@ module RequestAwareEntity
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
include
Gitlab
::
Routing
.
url_helpers
include
Gitlab
::
Routing
include
Gitlab
::
Allowable
end
end
def
request
def
request
@options
.
fetch
(
:request
)
options
.
fetch
(
:request
)
end
def
can?
(
object
,
action
,
subject
)
Ability
.
allowed?
(
object
,
action
,
subject
)
end
end
end
end
spec/serializers/request_aware_entity_spec.rb
0 → 100644
View file @
e072a274
require
'spec_helper'
describe
RequestAwareEntity
do
subject
do
Class
.
new
.
include
(
described_class
).
new
end
it
'includes URL helpers'
do
expect
(
subject
).
to
respond_to
(
:namespace_project_path
)
end
it
'includes method for checking abilities'
do
expect
(
subject
).
to
respond_to
(
:can?
)
end
it
'fetches request from options'
do
expect
(
subject
).
to
receive
(
:options
)
.
and_return
({
request:
'some value'
})
expect
(
subject
.
request
).
to
eq
'some value'
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