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
Léo-Paul Géneau
gitlab-ce
Commits
b9519c83
Commit
b9519c83
authored
Aug 13, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate label titel in project scope
parent
c9eaa46c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
4 deletions
+47
-4
app/models/label.rb
app/models/label.rb
+1
-1
features/project/issues/labels.feature
features/project/issues/labels.feature
+15
-2
features/steps/project/labels.rb
features/steps/project/labels.rb
+18
-0
features/steps/shared/paths.rb
features/steps/shared/paths.rb
+13
-1
No files found.
app/models/label.rb
View file @
b9519c83
...
...
@@ -12,7 +12,7 @@ class Label < ActiveRecord::Base
validates
:title
,
presence:
true
,
format:
{
with:
/\A[^&\?,&]*\z/
},
uniqueness:
true
uniqueness:
{
scope: :project_id
}
scope
:order_by_name
,
->
{
reorder
(
"labels.title ASC"
)
}
...
...
features/project/issues/labels.feature
View file @
b9519c83
...
...
@@ -10,7 +10,7 @@ Feature: Project Labels
And
I should see label
"feature"
Scenario
:
I
create new label
Given
I visit new label page
Given
I visit
project
"Shop"
new label page
When
I submit new label 'support'
Then
I should see label 'support'
...
...
@@ -25,6 +25,19 @@ Feature: Project Labels
Then
I should not see label 'bug'
Scenario
:
I
create a label with invalid color
Given
I visit new label page
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/labels.rb
View file @
b9519c83
...
...
@@ -31,18 +31,36 @@ class ProjectLabels < Spinach::FeatureSteps
click_button
'Save'
end
step
'I submit new label \'bug\''
do
fill_in
'Title'
,
with:
'bug'
fill_in
'Background Color'
,
with:
'#F95610'
click_button
'Save'
end
step
'I submit new label with invalid color'
do
fill_in
'Title'
,
with:
'support'
fill_in
'Background Color'
,
with:
'#12'
click_button
'Save'
end
step
'I should see label label exist error message'
do
within
'.label-form'
do
page
.
should
have_content
'Title has already been taken'
end
end
step
'I should see label color error message'
do
within
'.label-form'
do
page
.
should
have_content
'Color is invalid'
end
end
step
'I should see label \'bug\''
do
within
'.manage-labels-list'
do
page
.
should
have_content
'bug'
end
end
step
'I should not see label \'bug\''
do
within
'.manage-labels-list'
do
page
.
should_not
have_content
'bug'
...
...
features/steps/shared/paths.rb
View file @
b9519c83
...
...
@@ -287,10 +287,22 @@ module SharedPaths
end
step
'I visit project "Shop" labels page'
do
project
=
Project
.
find_by
(
name:
'Shop'
)
visit
project_labels_path
(
project
)
end
step
'I visit new label page'
do
step
'I visit project "Forum" labels page'
do
project
=
Project
.
find_by
(
name:
'Forum'
)
visit
project_labels_path
(
project
)
end
step
'I visit project "Shop" new label page'
do
project
=
Project
.
find_by
(
name:
'Shop'
)
visit
new_project_label_path
(
project
)
end
step
'I visit project "Forum" new label page'
do
project
=
Project
.
find_by
(
name:
'Forum'
)
visit
new_project_label_path
(
project
)
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