summaryrefslogtreecommitdiff
path: root/features
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-15 10:17:16 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-08-15 10:17:16 +0300
commit433dac7799a1a5fd4a0dfeaa0157148eb9058202 (patch)
tree363bd1609d2bef7fb502971bc7bb8d51209e5343 /features
parent7120af725148aae5092c0870c1da34ca5652f60d (diff)
parentcbc90565b55d89704d64bc48db323b82b739a873 (diff)
downloadgitlab-ce-433dac7799a1a5fd4a0dfeaa0157148eb9058202.tar.gz
Merge pull request #7465 from Razer6/better_label_color_validation
Better label color validation, fixes #7454
Diffstat (limited to 'features')
-rw-r--r--features/project/issues/labels.feature20
-rw-r--r--features/steps/project/labels.rb30
-rw-r--r--features/steps/shared/paths.rb14
3 files changed, 62 insertions, 2 deletions
diff --git a/features/project/issues/labels.feature b/features/project/issues/labels.feature
index 4a37b6dc9fa..29cf5307271 100644
--- a/features/project/issues/labels.feature
+++ b/features/project/issues/labels.feature
@@ -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'
@@ -23,3 +23,21 @@ 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 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'
+
diff --git a/features/steps/project/labels.rb b/features/steps/project/labels.rb
index 3d9aa29299c..8320405e096 100644
--- a/features/steps/project/labels.rb
+++ b/features/steps/project/labels.rb
@@ -31,6 +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'
diff --git a/features/steps/shared/paths.rb b/features/steps/shared/paths.rb
index 4e97dba20b3..0d06383509f 100644
--- a/features/steps/shared/paths.rb
+++ b/features/steps/shared/paths.rb
@@ -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