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
4971b85a
Commit
4971b85a
authored
Sep 07, 2017
by
Jarka Kadlecova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add feature specs for discussion lock
parent
360c1470
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
156 additions
and
1 deletion
+156
-1
app/views/shared/notes/_notes_with_form.html.haml
app/views/shared/notes/_notes_with_form.html.haml
+1
-1
spec/features/issuables/discussion_lock_spec.rb
spec/features/issuables/discussion_lock_spec.rb
+106
-0
spec/features/merge_requests/discussion_lock_spec.rb
spec/features/merge_requests/discussion_lock_spec.rb
+49
-0
No files found.
app/views/shared/notes/_notes_with_form.html.haml
View file @
4971b85a
...
...
@@ -28,7 +28,7 @@
.disabled-comment.text-center.prepend-top-default
%span
.issuable-note-warning
This
=
issuable
.
class
.
to_s
.
titleize
=
issuable
.
class
.
to_s
.
titleize
.
underscore
is locked. Only
%b
project members
can comment.
...
...
spec/features/issuables/discussion_lock_spec.rb
0 → 100644
View file @
4971b85a
require
'spec_helper'
describe
'Discussion Lock'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
author:
user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
before
do
sign_in
(
user
)
end
context
'when a user is a team member'
do
before
do
project
.
add_developer
(
user
)
end
context
'when the discussion is unlocked'
do
it
'the user can lock the issue'
do
visit
project_issue_path
(
project
,
issue
)
expect
(
find
(
'.issuable-sidebar'
)).
to
have_content
(
'Unlocked'
)
page
.
within
(
'.issuable-sidebar'
)
do
find
(
'.lock-edit'
).
click
click_button
(
'Lock'
)
end
expect
(
find
(
'#notes'
)).
to
have_content
(
'locked this issue'
)
end
end
context
'when the discussion is locked'
do
before
do
issue
.
update_attribute
(
:discussion_locked
,
true
)
visit
project_issue_path
(
project
,
issue
)
end
it
'the user can unlock the issue'
do
expect
(
find
(
'.issuable-sidebar'
)).
to
have_content
(
'Locked'
)
page
.
within
(
'.issuable-sidebar'
)
do
find
(
'.lock-edit'
).
click
click_button
(
'Unlock'
)
end
expect
(
find
(
'#notes'
)).
to
have_content
(
'unlocked this issue'
)
expect
(
find
(
'.issuable-sidebar'
)).
to
have_content
(
'Unlocked'
)
end
it
'the user can create a comment'
do
page
.
within
(
'#notes .js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
'Some new comment'
click_button
'Comment'
end
wait_for_requests
expect
(
find
(
'div#notes'
)).
to
have_content
(
'Some new comment'
)
end
end
end
context
'when a user is not a team member'
do
context
'when the discussion is unlocked'
do
before
do
visit
project_issue_path
(
project
,
issue
)
end
it
'the user can not lock the issue'
do
expect
(
find
(
'.issuable-sidebar'
)).
to
have_content
(
'Unlocked'
)
expect
(
find
(
'.issuable-sidebar'
)).
not_to
have_selector
(
'.lock-edit'
)
end
it
'the user can create a comment'
do
page
.
within
(
'#notes .js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
'Some new comment'
click_button
'Comment'
end
wait_for_requests
expect
(
find
(
'div#notes'
)).
to
have_content
(
'Some new comment'
)
end
end
context
'when the discussion is locked'
do
before
do
issue
.
update_attribute
(
:discussion_locked
,
true
)
visit
project_issue_path
(
project
,
issue
)
end
it
'the user can not unlock the issue'
do
expect
(
find
(
'.issuable-sidebar'
)).
to
have_content
(
'Locked'
)
expect
(
find
(
'.issuable-sidebar'
)).
not_to
have_selector
(
'.lock-edit'
)
end
it
'the user can not create a comment'
do
page
.
within
(
'#notes'
)
do
expect
(
page
).
not_to
have_selector
(
'js-main-target-form'
)
expect
(
page
.
find
(
'.disabled-comment'
)).
to
have_content
(
'This issue is locked. Only project members can comment.'
)
end
end
end
end
end
spec/features/merge_requests/discussion_lock_spec.rb
0 → 100644
View file @
4971b85a
require
'spec_helper'
describe
'Discussion Lock'
,
:js
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
author:
user
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
before
do
sign_in
(
user
)
end
context
'when the discussion is locked'
do
before
do
merge_request
.
update_attribute
(
:discussion_locked
,
true
)
end
context
'when a user is a team member'
do
before
do
project
.
add_developer
(
user
)
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'the user can create a comment'
do
page
.
within
(
'.issuable-discussion #notes .js-main-target-form'
)
do
fill_in
'note[note]'
,
with:
'Some new comment'
click_button
'Comment'
end
wait_for_requests
expect
(
find
(
'.issuable-discussion #notes'
)).
to
have_content
(
'Some new comment'
)
end
end
context
'when a user is not a team member'
do
before
do
visit
project_merge_request_path
(
project
,
merge_request
)
end
it
'the user can not create a comment'
do
page
.
within
(
'.issuable-discussion #notes'
)
do
expect
(
page
).
not_to
have_selector
(
'js-main-target-form'
)
expect
(
page
.
find
(
'.disabled-comment'
)).
to
have_content
(
'This merge request is locked. Only project members can comment.'
)
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