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
iv
gitlab-ce
Commits
bf96c305
Commit
bf96c305
authored
Apr 01, 2016
by
Phil Hughes
Committed by
Fatih Acet
May 19, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Award spec for merge requests
parent
44876032
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
140 additions
and
0 deletions
+140
-0
spec/features/merge_requests/award_spec.rb
spec/features/merge_requests/award_spec.rb
+140
-0
No files found.
spec/features/merge_requests/award_spec.rb
0 → 100644
View file @
bf96c305
require
'rails_helper'
feature
'Merge request awards'
,
js:
true
,
feature:
true
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
source_project:
project
)
}
let!
(
:note
)
{
create
(
:note_on_merge_request
,
project:
project
,
noteable:
merge_request
,
note:
'Looks good!'
)
}
describe
'logged in'
do
before
do
login_as
(
user
)
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
it
'should add award to merge request'
do
first
(
'.js-emoji-btn'
).
click
expect
(
page
).
to
have_selector
(
'.js-emoji-btn.active'
)
expect
(
first
(
'.js-emoji-btn'
)).
to
have_content
'1'
end
it
'should remove award from merge request'
do
first
(
'.js-emoji-btn'
).
click
find
(
'.js-emoji-btn.active'
).
click
expect
(
first
(
'.js-emoji-btn'
)).
to
have_content
'0'
end
it
'should show award menu button in notes'
do
page
.
within
(
'.note'
)
do
expect
(
page
).
to
have_selector
(
'.js-award-action-btn'
)
end
end
it
'should not show award bar on note if no awards given'
do
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
be_visible
end
end
it
'should be able to show award menu when clicking add award button in note'
do
show_note_award_menu
end
it
'should only have one menu on the page'
do
first
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
)
page
.
within
(
'.note'
)
do
find
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
,
count:
1
)
end
end
it
'should add award to note'
do
show_note_award_menu
award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
end
it
'should remove award from note'
do
show_note_award_menu
award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
remove_award_on_note
sleep
0.5
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
be_visible
expect
(
find
(
'.js-awards-block'
,
visible:
false
)).
not_to
have_selector
(
'.active'
)
end
end
it
'should not hide award bar on notes with more than 1 award'
do
show_note_award_menu
award_on_note
show_note_award_menu
award_on_note
(
2
)
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
expect
(
find
(
'.js-awards-block'
)).
to
have_selector
(
'.active'
)
end
remove_award_on_note
page
.
within
(
'.note'
)
do
expect
(
find
(
'.js-awards-block'
)).
to
be_visible
end
end
end
describe
'logged out'
do
before
do
visit
namespace_project_merge_request_path
(
project
.
namespace
,
project
,
merge_request
)
end
it
'should not see award menu button'
do
expect
(
page
).
not_to
have_selector
(
'.js-award-holder'
)
end
it
'should not see award menu button in note'
do
page
.
within
(
'.note'
)
do
expect
(
page
).
not_to
have_selector
(
'.js-award-action-btn'
)
end
end
end
def
show_note_award_menu
page
.
within
(
'.note'
)
do
find
(
'.js-add-award'
).
click
expect
(
page
).
to
have_selector
(
'.emoji-menu'
)
end
end
def
award_on_note
(
index
=
1
)
page
.
within
(
'.note'
)
do
page
.
within
(
'.emoji-menu'
)
do
buttons
=
all
(
'.js-emoji-btn'
)
buttons
[
index
].
click
end
end
end
def
remove_award_on_note
page
.
within
(
'.note'
)
do
page
.
within
(
'.js-awards-block'
)
do
first
(
'.js-emoji-btn'
).
click
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