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
Jérome Perrin
gitlab-ce
Commits
536bdf64
Commit
536bdf64
authored
Aug 17, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the set up of the state described in context to a before block
parent
84afd625
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
11 deletions
+21
-11
spec/controllers/projects/boards/issues_controller_spec.rb
spec/controllers/projects/boards/issues_controller_spec.rb
+3
-1
spec/controllers/projects/boards/lists_controller_spec.rb
spec/controllers/projects/boards/lists_controller_spec.rb
+9
-5
spec/controllers/projects/boards_controller_spec.rb
spec/controllers/projects/boards_controller_spec.rb
+9
-5
No files found.
spec/controllers/projects/boards/issues_controller_spec.rb
View file @
536bdf64
...
@@ -40,10 +40,12 @@ describe Projects::Boards::IssuesController do
...
@@ -40,10 +40,12 @@ describe Projects::Boards::IssuesController do
end
end
context
'with unauthorized user'
do
context
'with unauthorized user'
do
it
'returns a successful 403 response'
do
before
do
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_issue
,
project
).
and_return
(
false
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_issue
,
project
).
and_return
(
false
)
end
it
'returns a successful 403 response'
do
list_issues
user:
user
,
list_id:
list2
list_issues
user:
user
,
list_id:
list2
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_http_status
(
403
)
...
...
spec/controllers/projects/boards/lists_controller_spec.rb
View file @
536bdf64
...
@@ -33,13 +33,17 @@ describe Projects::Boards::ListsController do
...
@@ -33,13 +33,17 @@ describe Projects::Boards::ListsController do
expect
(
parsed_response
.
length
).
to
eq
3
expect
(
parsed_response
.
length
).
to
eq
3
end
end
it
'returns a successful 403 response with unauthorized user'
do
context
'with unauthorized user'
do
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
before
do
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_list
,
project
).
and_return
(
false
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_list
,
project
).
and_return
(
false
)
end
read_board_list
user:
user
it
'returns a successful 403 response'
do
read_board_list
user:
user
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_http_status
(
403
)
end
end
end
def
read_board_list
(
user
:)
def
read_board_list
(
user
:)
...
...
spec/controllers/projects/boards_controller_spec.rb
View file @
536bdf64
...
@@ -21,13 +21,17 @@ describe Projects::BoardsController do
...
@@ -21,13 +21,17 @@ describe Projects::BoardsController do
expect
(
response
.
content_type
).
to
eq
'text/html'
expect
(
response
.
content_type
).
to
eq
'text/html'
end
end
it
'returns a successful 404 response with unauthorized user'
do
context
'with unauthorized user'
do
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
before
do
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
.
abilities
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
end
read_board
it
'returns a successful 404 response'
do
read_board
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_http_status
(
404
)
end
end
end
def
read_board
(
format: :html
)
def
read_board
(
format: :html
)
...
...
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