BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
a4e3b326
Commit
a4e3b326
authored
Apr 03, 2018
by
blackst0ne
Committed by
Rémy Coutable
Apr 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the `project/issues/labels.feature` spinach test with an rspec analog
parent
0dcd92ba
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
193 additions
and
154 deletions
+193
-154
blackst0ne-replace-spinach-project-issues-labels-feature.yml
...ckst0ne-replace-spinach-project-issues-labels-feature.yml
+5
-0
labels.feature
features/project/issues/labels.feature
+0
-48
labels.rb
features/steps/project/issues/labels.rb
+0
-101
paths.rb
features/steps/shared/paths.rb
+0
-5
user_creates_labels_spec.rb
spec/features/projects/labels/user_creates_labels_spec.rb
+88
-0
user_edits_labels_spec.rb
spec/features/projects/labels/user_edits_labels_spec.rb
+25
-0
user_removes_labels_spec.rb
spec/features/projects/labels/user_removes_labels_spec.rb
+52
-0
user_views_labels_spec.rb
spec/features/projects/labels/user_views_labels_spec.rb
+23
-0
No files found.
changelogs/unreleased/blackst0ne-replace-spinach-project-issues-labels-feature.yml
0 → 100644
View file @
a4e3b326
---
title
:
Replace the `project/issues/labels.feature` spinach test with an rspec analog
merge_request
:
18126
author
:
blackst0ne
type
:
other
features/project/issues/labels.feature
deleted
100644 → 0
View file @
0dcd92ba
@project_issues
Feature
:
Project Issues Labels
Background
:
Given
I sign in as a user
And
I own project
"Shop"
And project "Shop" has labels
:
"bug",
"feature",
"enhancement"
Given
I visit project
"Shop"
labels page
Scenario
:
I
should see labels list
Then
I should see label 'bug'
And
I should see label 'feature'
Scenario
:
I
create new label
Given
I visit project
"Shop"
new label page
When
I submit new label 'support'
Then
I should see label 'support'
Scenario
:
I
edit label
Given
I visit 'bug' label edit page
When
I change label 'bug' to 'fix'
Then
I should not see label 'bug'
Then
I should see label 'fix'
Scenario
:
I
remove label
When
I remove label 'bug'
Then
I should not see label 'bug'
@javascript
Scenario
:
I
remove all labels
When
I delete all labels
Then
I should see labels help message
Scenario
:
I
create a label with invalid color
Given
I visit project
"Shop"
new label page
When
I submit new label with invalid color
Then
I should see label color error message
Scenario
:
I
create a label that already exists
Given
I visit project
"Shop"
new label page
When
I submit new label 'bug'
Then
I should see label label exist error message
Scenario
:
I
create the same label on another project
Given
I own project
"Forum"
And
I visit project
"Forum"
labels page
And
I visit project
"Forum"
new label page
When
I submit new label 'bug'
Then
I should see label 'bug'
features/steps/project/issues/labels.rb
deleted
100644 → 0
View file @
0dcd92ba
class
Spinach
::
Features
::
ProjectIssuesLabels
<
Spinach
::
FeatureSteps
include
SharedAuthentication
include
SharedProject
include
SharedPaths
step
'I visit \'bug\' label edit page'
do
visit
edit_project_label_path
(
project
,
bug_label
)
end
step
'I remove label \'bug\''
do
page
.
within
"#project_label_
#{
bug_label
.
id
}
"
do
first
(
:link
,
'Delete'
).
click
end
end
step
'I delete all labels'
do
page
.
within
'.labels'
do
page
.
all
(
'.label-list-item'
).
each
do
first
(
'.remove-row'
).
click
first
(
:link
,
'Delete label'
).
click
end
end
end
step
'I should see labels help message'
do
page
.
within
'.labels'
do
expect
(
page
).
to
have_content
'Generate a default set of labels'
expect
(
page
).
to
have_content
'New label'
end
end
step
'I submit new label \'support\''
do
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Create label'
end
step
'I submit new label \'bug\''
do
fill_in
'Title'
,
with:
'bug'
fill_in
'Background color'
,
with:
'#F95610'
click_button
'Create label'
end
step
'I submit new label with invalid color'
do
fill_in
'Title'
,
with:
'support'
fill_in
'Background color'
,
with:
'#12'
click_button
'Create label'
end
step
'I should see label label exist error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Title has already been taken'
end
end
step
'I should see label color error message'
do
page
.
within
'.label-form'
do
expect
(
page
).
to
have_content
'Color must be a valid color code'
end
end
step
'I should see label \'feature\''
do
page
.
within
'.other-labels .manage-labels-list'
do
expect
(
page
).
to
have_content
'feature'
end
end
step
'I should see label \'bug\''
do
page
.
within
'.other-labels .manage-labels-list'
do
expect
(
page
).
to
have_content
'bug'
end
end
step
'I should not see label \'bug\''
do
page
.
within
'.other-labels .manage-labels-list'
do
expect
(
page
).
not_to
have_content
'bug'
end
end
step
'I should see label \'support\''
do
page
.
within
'.other-labels .manage-labels-list'
do
expect
(
page
).
to
have_content
'support'
end
end
step
'I change label \'bug\' to \'fix\''
do
fill_in
'Title'
,
with:
'fix'
fill_in
'Background color'
,
with:
'#F15610'
click_button
'Save changes'
end
step
'I should see label \'fix\''
do
page
.
within
'.other-labels .manage-labels-list'
do
expect
(
page
).
to
have_content
'fix'
end
end
def
bug_label
project
.
labels
.
find_or_create_by
(
title:
'bug'
)
end
end
features/steps/shared/paths.rb
View file @
a4e3b326
...
...
@@ -336,11 +336,6 @@ module SharedPaths
visit
project_issue_path
(
issue
.
project
,
issue
)
end
step
'I visit project "Shop" labels page'
do
project
=
Project
.
find_by
(
name:
'Shop'
)
visit
project_labels_path
(
project
)
end
step
'I visit project "Forum" labels page'
do
project
=
Project
.
find_by
(
name:
'Forum'
)
visit
project_labels_path
(
project
)
...
...
spec/features/projects/labels/user_creates_labels_spec.rb
0 → 100644
View file @
a4e3b326
require
"spec_helper"
describe
"User creates labels"
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:user
)
{
create
(
:user
)
}
shared_examples_for
"label creation"
do
it
"creates new label"
do
title
=
"bug"
create_label
(
title
)
page
.
within
(
".other-labels .manage-labels-list"
)
do
expect
(
page
).
to
have_content
(
title
)
end
end
end
context
"in project"
do
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
new_project_label_path
(
project
))
end
context
"when data is valid"
do
include_examples
"label creation"
end
context
"when data is invalid"
do
context
"when title is invalid"
do
it
"shows error message"
do
create_label
(
""
)
page
.
within
(
".label-form"
)
do
expect
(
page
).
to
have_content
(
"Title can't be blank"
)
end
end
end
context
"when color is invalid"
do
it
"shows error message"
do
create_label
(
"feature"
,
"#12"
)
page
.
within
(
".label-form"
)
do
expect
(
page
).
to
have_content
(
"Color must be a valid color code"
)
end
end
end
end
context
"when label already exists"
do
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
it
"shows error message"
do
create_label
(
label
.
title
)
page
.
within
(
".label-form"
)
do
expect
(
page
).
to
have_content
(
"Title has already been taken"
)
end
end
end
end
context
"in another project"
do
set
(
:another_project
)
{
create
(
:project_empty_repo
,
:public
)
}
before
do
create
(
:label
,
project:
project
,
title:
"bug"
)
# Create label for `project` (not `another_project`) project.
another_project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
new_project_label_path
(
another_project
))
end
include_examples
"label creation"
end
private
def
create_label
(
title
,
color
=
"#F95610"
)
fill_in
(
"Title"
,
with:
title
)
fill_in
(
"Background color"
,
with:
color
)
click_button
(
"Create label"
)
end
end
spec/features/projects/labels/user_edits_labels_spec.rb
0 → 100644
View file @
a4e3b326
require
"spec_helper"
describe
"User edits labels"
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:label
)
{
create
(
:label
,
project:
project
)
}
set
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
visit
(
edit_project_label_path
(
project
,
label
))
end
it
"updates label's title"
do
new_title
=
"fix"
fill_in
(
"Title"
,
with:
new_title
)
click_button
(
"Save changes"
)
page
.
within
(
".other-labels .manage-labels-list"
)
do
expect
(
page
).
to
have_content
(
new_title
).
and
have_no_content
(
label
.
title
)
end
end
end
spec/features/projects/labels/user_removes_labels_spec.rb
0 → 100644
View file @
a4e3b326
require
"spec_helper"
describe
"User removes labels"
do
let
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_master
(
user
)
sign_in
(
user
)
end
context
"when one label"
do
let!
(
:label
)
{
create
(
:label
,
project:
project
)
}
before
do
visit
(
project_labels_path
(
project
))
end
it
"removes label"
do
page
.
within
(
".labels"
)
do
page
.
first
(
".label-list-item"
)
do
first
(
".remove-row"
).
click
first
(
:link
,
"Delete label"
).
click
end
end
expect
(
page
).
to
have_content
(
"Label was removed"
).
and
have_no_content
(
label
.
title
)
end
end
context
"when many labels"
,
:js
do
before
do
create_list
(
:label
,
3
,
project:
project
)
visit
(
project_labels_path
(
project
))
end
it
"removes all labels"
do
page
.
within
(
".labels"
)
do
loop
do
li
=
page
.
first
(
".label-list-item"
)
break
unless
li
li
.
click_link
(
"Delete"
)
click_link
(
"Delete label"
)
end
expect
(
page
).
to
have_content
(
"Generate a default set of labels"
).
and
have_content
(
"New label"
)
end
end
end
end
spec/features/projects/labels/user_views_labels_spec.rb
0 → 100644
View file @
a4e3b326
require
"spec_helper"
describe
"User views labels"
do
set
(
:project
)
{
create
(
:project_empty_repo
,
:public
)
}
set
(
:user
)
{
create
(
:user
)
}
LABEL_TITLES
=
%w[bug enhancement feature]
.
freeze
before
do
LABEL_TITLES
.
each
{
|
title
|
create
(
:label
,
project:
project
,
title:
title
)
}
project
.
add_guest
(
user
)
sign_in
(
user
)
visit
(
project_labels_path
(
project
))
end
it
"shows all labels"
do
page
.
within
(
'.other-labels .manage-labels-list'
)
do
LABEL_TITLES
.
each
{
|
title
|
expect
(
page
).
to
have_content
(
title
)
}
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