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
Boxiang Sun
gitlab-ce
Commits
2023ac4c
Commit
2023ac4c
authored
May 22, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce CE/EE diff in spec/controllers/projects/boards_controller_spec.rb
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
34862867
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
18 deletions
+48
-18
spec/controllers/projects/boards_controller_spec.rb
spec/controllers/projects/boards_controller_spec.rb
+48
-18
No files found.
spec/controllers/projects/boards_controller_spec.rb
View file @
2023ac4c
...
@@ -27,6 +27,20 @@ describe Projects::BoardsController do
...
@@ -27,6 +27,20 @@ describe Projects::BoardsController do
expect
(
response
).
to
render_template
:index
expect
(
response
).
to
render_template
:index
expect
(
response
.
content_type
).
to
eq
'text/html'
expect
(
response
.
content_type
).
to
eq
'text/html'
end
end
context
'with unauthorized user'
do
before
do
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
list_boards
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
.
content_type
).
to
eq
'text/html'
end
end
end
end
context
'when format is JSON'
do
context
'when format is JSON'
do
...
@@ -40,7 +54,6 @@ describe Projects::BoardsController do
...
@@ -40,7 +54,6 @@ describe Projects::BoardsController do
expect
(
response
).
to
match_response_schema
(
'boards'
)
expect
(
response
).
to
match_response_schema
(
'boards'
)
expect
(
parsed_response
.
length
).
to
eq
2
expect
(
parsed_response
.
length
).
to
eq
2
end
end
end
context
'with unauthorized user'
do
context
'with unauthorized user'
do
before
do
before
do
...
@@ -49,9 +62,11 @@ describe Projects::BoardsController do
...
@@ -49,9 +62,11 @@ describe Projects::BoardsController do
end
end
it
'returns a not found 404 response'
do
it
'returns a not found 404 response'
do
list_boards
list_boards
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
.
content_type
).
to
eq
'application/json'
end
end
end
end
end
...
@@ -88,6 +103,20 @@ describe Projects::BoardsController do
...
@@ -88,6 +103,20 @@ describe Projects::BoardsController do
expect
(
response
).
to
render_template
:show
expect
(
response
).
to
render_template
:show
expect
(
response
.
content_type
).
to
eq
'text/html'
expect
(
response
.
content_type
).
to
eq
'text/html'
end
end
context
'with unauthorized user'
do
before
do
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_project
,
project
).
and_return
(
true
)
allow
(
Ability
).
to
receive
(
:allowed?
).
with
(
user
,
:read_board
,
project
).
and_return
(
false
)
end
it
'returns a not found 404 response'
do
read_board
board:
board
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
.
content_type
).
to
eq
'text/html'
end
end
end
end
context
'when format is JSON'
do
context
'when format is JSON'
do
...
@@ -96,7 +125,6 @@ describe Projects::BoardsController do
...
@@ -96,7 +125,6 @@ describe Projects::BoardsController do
expect
(
response
).
to
match_response_schema
(
'board'
)
expect
(
response
).
to
match_response_schema
(
'board'
)
end
end
end
context
'with unauthorized user'
do
context
'with unauthorized user'
do
before
do
before
do
...
@@ -105,9 +133,11 @@ describe Projects::BoardsController do
...
@@ -105,9 +133,11 @@ describe Projects::BoardsController do
end
end
it
'returns a not found 404 response'
do
it
'returns a not found 404 response'
do
read_board
board:
board
read_board
board:
board
,
format: :json
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
).
to
have_gitlab_http_status
(
404
)
expect
(
response
.
content_type
).
to
eq
'application/json'
end
end
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