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
2ca32a09
Commit
2ca32a09
authored
Jun 03, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for the case when user can't prioritize labels
parent
a966e6e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
47 deletions
+77
-47
spec/features/projects/labels/update_prioritization_spec.rb
spec/features/projects/labels/update_prioritization_spec.rb
+77
-47
No files found.
spec/features/projects/labels/update_prioritization_spec.rb
View file @
2ca32a09
...
@@ -3,76 +3,106 @@ require 'spec_helper'
...
@@ -3,76 +3,106 @@ require 'spec_helper'
feature
'Prioritize labels'
,
feature:
true
do
feature
'Prioritize labels'
,
feature:
true
do
include
WaitForAjax
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
context
'when project belongs to user'
do
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
}
scenario
'user can prioritize a label'
,
js:
true
do
scenario
'user can prioritize a label'
,
js:
true
do
bug
=
create
(
:label
,
title:
'bug'
)
bug
=
create
(
:label
,
title:
'bug'
)
wontfix
=
create
(
:label
,
title:
'wontfix'
)
wontfix
=
create
(
:label
,
title:
'wontfix'
)
project
.
labels
<<
bug
project
.
labels
<<
bug
project
.
labels
<<
wontfix
project
.
labels
<<
wontfix
login_as
user
login_as
user
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_content
(
'No prioritized labels yet'
)
expect
(
page
).
to
have_content
(
'No prioritized labels yet'
)
page
.
within
(
'.other-labels'
)
do
page
.
within
(
'.other-labels'
)
do
first
(
'.js-toggle-priority'
).
click
first
(
'.js-toggle-priority'
).
click
wait_for_ajax
wait_for_ajax
expect
(
page
).
not_to
have_content
(
'bug'
)
expect
(
page
).
not_to
have_content
(
'bug'
)
end
page
.
within
(
'.prioritized-labels'
)
do
expect
(
page
).
not_to
have_content
(
'No prioritized labels yet'
)
expect
(
page
).
to
have_content
(
'bug'
)
end
end
end
page
.
within
(
'.prioritized-labels'
)
do
scenario
'user can unprioritize a label'
,
js:
true
do
expect
(
page
).
not_to
have_content
(
'No prioritized labels yet'
)
bug
=
create
(
:label
,
title:
'bug'
,
priority:
1
)
wontfix
=
create
(
:label
,
title:
'wontfix'
)
project
.
labels
<<
bug
project
.
labels
<<
wontfix
login_as
user
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_content
(
'bug'
)
expect
(
page
).
to
have_content
(
'bug'
)
page
.
within
(
'.prioritized-labels'
)
do
first
(
'.js-toggle-priority'
).
click
wait_for_ajax
expect
(
page
).
not_to
have_content
(
'bug'
)
end
page
.
within
(
'.other-labels'
)
do
expect
(
page
).
to
have_content
(
'bug'
)
expect
(
page
).
to
have_content
(
'wontfix'
)
end
end
end
end
scenario
'user can unprioritize a label
'
,
js:
true
do
scenario
'user can sort prioritized labels
'
,
js:
true
do
bug
=
create
(
:label
,
title:
'bug'
,
priority:
1
)
bug
=
create
(
:label
,
title:
'bug'
,
priority:
1
)
wontfix
=
create
(
:label
,
title:
'wontfix'
)
wontfix
=
create
(
:label
,
title:
'wontfix'
,
priority:
2
)
project
.
labels
<<
bug
project
.
labels
<<
bug
project
.
labels
<<
wontfix
project
.
labels
<<
wontfix
login_as
user
login_as
user
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_content
(
'bug'
)
expect
(
page
).
to
have_content
'bug'
expect
(
page
).
to
have_content
'wontfix'
page
.
within
(
'.prioritized-labels'
)
do
# Sort labels
first
(
'.js-toggle-priority'
).
click
find
(
"#label_
#{
bug
.
id
}
"
).
drag_to
find
(
"#label_
#{
wontfix
.
id
}
"
)
wait_for_ajax
expect
(
page
).
not_to
have_content
(
'bug'
)
end
page
.
within
(
'.other-labels'
)
do
page
.
within
(
'.prioritized-labels'
)
do
expect
(
page
).
to
have_content
(
'bug'
)
expect
(
first
(
'li'
)).
to
have_content
(
'wontfix'
)
expect
(
page
).
to
have_content
(
'wontfix'
)
expect
(
page
.
all
(
'li'
).
last
).
to
have_content
(
'bug'
)
end
end
end
end
end
scenario
'user can sort prioritized labels'
,
js:
true
do
context
'as a guest'
do
bug
=
create
(
:label
,
title:
'bug'
,
priority:
1
)
it
'can not prioritize labels'
do
wontfix
=
create
(
:label
,
title:
'wontfix'
,
priority:
2
)
user
=
create
(
:user
)
guest
=
create
(
:user
)
project
=
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
create
(
:label
,
title:
'bug'
)
project
.
labels
<<
bug
login_as
guest
project
.
labels
<<
wontfix
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
expect
(
page
).
not_to
have_css
(
'.prioritized-labels'
)
end
end
login_as
user
context
'as a non signed in user'
do
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
it
'can not prioritize labels'
do
user
=
create
(
:user
)
project
=
create
(
:project
,
name:
'test'
,
namespace:
user
.
namespace
)
expect
(
page
).
to
have_content
'bug'
create
(
:label
,
title:
'bug'
)
expect
(
page
).
to
have_content
'wontfix'
# Sort labels
visit
namespace_project_labels_path
(
project
.
namespace
,
project
)
find
(
"#label_
#{
bug
.
id
}
"
).
drag_to
find
(
"#label_
#{
wontfix
.
id
}
"
)
page
.
within
(
'.prioritized-labels'
)
do
expect
(
page
).
not_to
have_css
(
'.prioritized-labels'
)
expect
(
first
(
'li'
)).
to
have_content
(
'wontfix'
)
expect
(
page
.
all
(
'li'
).
last
).
to
have_content
(
'bug'
)
end
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