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
f50a8065
Commit
f50a8065
authored
Jun 16, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed reportable_note_shared_example for the reportable_note/snippets_spec
parent
0bfe78d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
15 deletions
+37
-15
spec/features/reportable_note/snippets_spec.rb
spec/features/reportable_note/snippets_spec.rb
+3
-2
spec/support/features/reportable_note_shared_examples.rb
spec/support/features/reportable_note_shared_examples.rb
+34
-13
No files found.
spec/features/reportable_note/snippets_spec.rb
View file @
f50a8065
...
@@ -22,12 +22,13 @@ describe 'Reportable note on snippets', :feature, :js do
...
@@ -22,12 +22,13 @@ describe 'Reportable note on snippets', :feature, :js do
describe
'on personal snippet'
do
describe
'on personal snippet'
do
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
let
(
:snippet
)
{
create
(
:personal_snippet
,
:public
,
author:
user
)
}
let!
(
:note
)
{
create
(
:note_on_personal_snippet
,
noteable:
snippet
,
author:
user
)
}
let!
(
:note
)
{
create
(
:note_on_personal_snippet
,
noteable:
snippet
)
}
let!
(
:owners_note
)
{
create
(
:note_on_personal_snippet
,
noteable:
snippet
,
author:
user
)
}
before
do
before
do
visit
snippet_path
(
snippet
)
visit
snippet_path
(
snippet
)
end
end
it_behaves_like
'reportable note'
it_behaves_like
'reportable note'
,
true
end
end
end
end
spec/support/features/reportable_note_shared_examples.rb
View file @
f50a8065
require
'spec_helper'
require
'spec_helper'
shared_examples
'reportable note'
do
shared_examples
'reportable note'
do
|
is_a_personal_snippet
|
include
NotesHelper
include
NotesHelper
let
(
:comment
)
{
find
(
"#
#{
ActionView
::
RecordIdentifier
.
dom_id
(
note
)
}
"
)
}
let
(
:comment
)
{
find
(
"#
#{
ActionView
::
RecordIdentifier
.
dom_id
(
note
)
}
"
)
}
...
@@ -11,26 +11,47 @@ shared_examples 'reportable note' do
...
@@ -11,26 +11,47 @@ shared_examples 'reportable note' do
expect
(
comment
).
to
have_selector
(
more_actions_selector
)
expect
(
comment
).
to
have_selector
(
more_actions_selector
)
end
end
it
'dropdown has Edit, Report and Delete links'
do
if
is_a_personal_snippet
dropdown
=
comment
.
find
(
more_actions_selector
)
it
'dropdown has Report link on other users comment'
do
dropdown
=
comment
.
find
(
more_actions_selector
)
dropdown
.
click
open_dropdown
(
dropdown
)
dropdown
.
find
(
'.dropdown-menu li'
,
match: :first
)
expect
(
dropdown
).
to
have_link
(
'Report as abuse'
,
href:
abuse_report_path
)
expect
(
dropdown
).
to
have_button
(
'Edit comment'
)
end
expect
(
dropdown
).
to
have_link
(
'Report as abuse'
,
href:
abuse_report_path
)
expect
(
dropdown
).
to
have_link
(
'Delete comment'
,
href:
note_url
(
note
,
project
))
it
'dropdown has Edit and Delete links on the owners comment'
do
find
(
'#notes-list .note'
,
match: :first
)
other_comment
=
all
(
'#notes-list .note'
).
last
dropdown
=
other_comment
.
find
(
more_actions_selector
)
open_dropdown
(
dropdown
)
expect
(
dropdown
).
to
have_button
(
'Edit comment'
)
expect
(
dropdown
).
to
have_link
(
'Delete comment'
,
href:
note_url
(
owners_note
,
project
))
end
else
it
'dropdown has Edit, Report and Delete links'
do
dropdown
=
comment
.
find
(
more_actions_selector
)
open_dropdown
(
dropdown
)
expect
(
dropdown
).
to
have_button
(
'Edit comment'
)
expect
(
dropdown
).
to
have_link
(
'Report as abuse'
,
href:
abuse_report_path
)
expect
(
dropdown
).
to
have_link
(
'Delete comment'
,
href:
note_url
(
note
,
project
))
end
end
end
it
'Report button links to a report page'
do
it
'Report button links to a report page'
do
dropdown
=
comment
.
find
(
more_actions_selector
)
dropdown
=
comment
.
find
(
more_actions_selector
)
open_dropdown
(
dropdown
)
dropdown
.
click
dropdown
.
find
(
'.dropdown-menu li'
,
match: :first
)
dropdown
.
click_link
(
'Report as abuse'
)
dropdown
.
click_link
(
'Report as abuse'
)
expect
(
find
(
'#user_name'
)[
'value'
]).
to
match
(
note
.
author
.
username
)
expect
(
find
(
'#user_name'
)[
'value'
]).
to
match
(
note
.
author
.
username
)
expect
(
find
(
'#abuse_report_message'
)[
'value'
]).
to
match
(
noteable_note_url
(
note
))
expect
(
find
(
'#abuse_report_message'
)[
'value'
]).
to
match
(
noteable_note_url
(
note
))
end
end
def
open_dropdown
(
dropdown
)
dropdown
.
click
dropdown
.
find
(
'.dropdown-menu li'
,
match: :first
)
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