Commit 0f474887 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Project labels tests

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 3ed2fce2
%li %li{id: dom_id(label)}
= render_colored_label(label) = render_colored_label(label)
.pull-right .pull-right
%strong.append-right-20 %strong.append-right-20
......
...@@ -5,6 +5,21 @@ Feature: Project Labels ...@@ -5,6 +5,21 @@ Feature: Project Labels
And project "Shop" has labels: "bug", "feature", "enhancement" And project "Shop" has labels: "bug", "feature", "enhancement"
Given I visit project "Shop" labels page Given I visit project "Shop" labels page
Scenario: I should see active milestones Scenario: I should see labels list
Then I should see label "bug" Then I should see label "bug"
And I should see label "feature" And I should see label "feature"
Scenario: I create new label
Given I visit 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'
...@@ -3,15 +3,59 @@ class ProjectLabels < Spinach::FeatureSteps ...@@ -3,15 +3,59 @@ class ProjectLabels < Spinach::FeatureSteps
include SharedProject include SharedProject
include SharedPaths include SharedPaths
Then 'I should see label "bug"' do step 'I should see label "bug"' do
within ".manage-labels-list" do within ".manage-labels-list" do
page.should have_content "bug" page.should have_content "bug"
end end
end end
And 'I should see label "feature"' do step 'I should see label "feature"' do
within ".manage-labels-list" do within ".manage-labels-list" do
page.should have_content "feature" page.should have_content "feature"
end end
end end
step 'I visit \'bug\' label edit page' do
visit edit_project_label_path(project, bug_label)
end
step 'I remove label \'bug\'' do
within "#label_#{bug_label.id}" do
click_link 'Remove'
end
end
step 'I submit new label \'support\'' do
fill_in 'Title', with: 'support'
fill_in 'Background Color', with: '#F95610'
click_button 'Save'
end
step 'I should not see label \'bug\'' do
within '.manage-labels-list' do
page.should_not have_content 'bug'
end
end
step 'I should see label \'support\'' do
within '.manage-labels-list' do
page.should 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'
end
step 'I should see label \'fix\'' do
within '.manage-labels-list' do
page.should have_content 'fix'
end
end
def bug_label
project.labels.find_or_create_by(title: 'bug')
end
end end
...@@ -289,6 +289,10 @@ module SharedPaths ...@@ -289,6 +289,10 @@ module SharedPaths
visit project_labels_path(project) visit project_labels_path(project)
end end
step 'I visit new label page' do
visit new_project_label_path(project)
end
step 'I visit merge request page "Bug NS-04"' do step 'I visit merge request page "Bug NS-04"' do
mr = MergeRequest.find_by(title: "Bug NS-04") mr = MergeRequest.find_by(title: "Bug NS-04")
visit project_merge_request_path(mr.target_project, mr) visit project_merge_request_path(mr.target_project, mr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment