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
0bfe78d7
Commit
0bfe78d7
authored
Jun 15, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass more_actions_dropdown vie spec locals to render call instead of stubbing them
parent
2ef19a24
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
44 deletions
+15
-44
spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb
...s/projects/notes/_more_actions_dropdown.html.haml_spec.rb
+15
-44
No files found.
spec/views/projects/notes/_more_actions_dropdown.html.haml_spec.rb
View file @
0bfe78d7
...
@@ -9,62 +9,33 @@ describe 'projects/notes/_more_actions_dropdown', :view do
...
@@ -9,62 +9,33 @@ describe 'projects/notes/_more_actions_dropdown', :view do
let!
(
:note
)
{
create
(
:note_on_issue
,
author:
author_user
,
noteable:
issue
,
project:
project
)
}
let!
(
:note
)
{
create
(
:note_on_issue
,
author:
author_user
,
noteable:
issue
,
project:
project
)
}
before
do
before
do
allow
(
view
).
to
receive
(
:note
).
and_return
(
note
)
assign
(
:project
,
project
)
assign
(
:project
,
project
)
end
end
context
'not editable and not current users comment'
do
it
'shows Report as abuse button if not editable and not current users comment'
do
before
do
render
'projects/notes/more_actions_dropdown'
,
current_user:
not_author_user
,
note_editable:
false
,
note:
note
allow
(
view
).
to
receive
(
:note_editable
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
not_author_user
)
render
end
it
'shows Report as abuse button'
do
expect
(
rendered
).
to
have_link
(
'Report as abuse'
)
expect
(
rendered
).
to
have_link
(
'Report as abuse'
)
end
end
end
context
'not editable and current users comment'
do
it
'does not show the More actions button if not editable and current users comment'
do
before
do
render
'projects/notes/more_actions_dropdown'
,
current_user:
author_user
,
note_editable:
false
,
note:
note
allow
(
view
).
to
receive
(
:note_editable
).
and_return
(
false
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
author_user
)
render
end
it
'does not show the More actions button'
do
expect
(
rendered
).
not_to
have_selector
(
'.dropdown.more-actions'
)
expect
(
rendered
).
not_to
have_selector
(
'.dropdown.more-actions'
)
end
end
end
context
'editable and not current users comment'
do
it
'shows Report as abuse, Edit and Delete buttons if editable and not current users comment'
do
before
do
render
'projects/notes/more_actions_dropdown'
,
current_user:
not_author_user
,
note_editable:
true
,
note:
note
allow
(
view
).
to
receive
(
:note_editable
).
and_return
(
true
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
not_author_user
)
render
end
it
'shows Report as abuse, Edit and Delete buttons'
do
expect
(
rendered
).
to
have_link
(
'Report as abuse'
)
expect
(
rendered
).
to
have_link
(
'Report as abuse'
)
expect
(
rendered
).
to
have_button
(
'Edit comment'
)
expect
(
rendered
).
to
have_button
(
'Edit comment'
)
expect
(
rendered
).
to
have_link
(
'Delete comment'
)
expect
(
rendered
).
to
have_link
(
'Delete comment'
)
end
end
end
context
'editable and current users comment'
do
it
'shows Edit and Delete buttons if editable and current users comment'
do
before
do
render
'projects/notes/more_actions_dropdown'
,
current_user:
author_user
,
note_editable:
true
,
note:
note
allow
(
view
).
to
receive
(
:note_editable
).
and_return
(
true
)
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
author_user
)
render
end
it
'shows Edit and Delete buttons'
do
expect
(
rendered
).
to
have_button
(
'Edit comment'
)
expect
(
rendered
).
to
have_button
(
'Edit comment'
)
expect
(
rendered
).
to
have_link
(
'Delete comment'
)
expect
(
rendered
).
to
have_link
(
'Delete 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