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
a3c969cd
Commit
a3c969cd
authored
Aug 11, 2014
by
Robert Schilling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add testcase for invalid color
parent
6085b6a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
2 deletions
+21
-2
label.rb
app/models/label.rb
+4
-2
labels.feature
features/project/issues/labels.feature
+5
-0
labels.rb
features/steps/project/labels.rb
+12
-0
No files found.
app/models/label.rb
View file @
a3c969cd
...
...
@@ -3,10 +3,12 @@ class Label < ActiveRecord::Base
has_many
:label_links
,
dependent: :destroy
has_many
:issues
,
through: :label_links
,
source: :target
,
source_type:
'Issue'
validates
:color
,
format:
{
with:
/\A\#[0-9A-Fa-f]{6}+\Z/
},
allow_blank:
true
validates
:color
,
format:
{
with:
/\A\#[0-9A-Fa-f]{6}+\Z/
},
allow_blank:
false
validates
:project
,
presence:
true
# Dont allow '?', '&', and ',' for label titles
# Don
'
t allow '?', '&', and ',' for label titles
validates
:title
,
presence:
true
,
format:
{
with:
/\A[^&\?,&]*\z/
}
scope
:order_by_name
,
->
{
reorder
(
"labels.title ASC"
)
}
...
...
features/project/issues/labels.feature
View file @
a3c969cd
...
...
@@ -23,3 +23,8 @@ Feature: Project Labels
Scenario
:
I
remove label
When
I remove label 'bug'
Then
I should not see label 'bug'
Scenario
:
I
create a label with invalid color
Given
I visit new label page
When
I submit new label with invalid color
Then
I should see label color error message
features/steps/project/labels.rb
View file @
a3c969cd
...
...
@@ -31,6 +31,18 @@ class ProjectLabels < Spinach::FeatureSteps
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 color error message'
do
within
'.label-form'
do
page
.
should
have_content
'Color is invalid'
end
end
step
'I should not see label \'bug\''
do
within
'.manage-labels-list'
do
page
.
should_not
have_content
'bug'
...
...
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