summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <rdavila84@gmail.com>2016-02-22 13:17:38 -0500
committerRubén Dávila <rdavila84@gmail.com>2016-02-22 13:17:38 -0500
commit3d96bfaa8aa24f6ecdfb6c2e4189b01bb0ce1b51 (patch)
treedd1174d5d011a9948d47804003d7a5b10aa729a0
parent2cc9a42ca45d14fc7fe35ea6f8bc4f9275f33144 (diff)
downloadgitlab-ce-3d96bfaa8aa24f6ecdfb6c2e4189b01bb0ce1b51.tar.gz
Don't repeat labels listed on Labels tab.issue_13621
-rw-r--r--app/models/milestone.rb2
-rw-r--r--features/project/milestone.feature1
-rw-r--r--features/steps/project/project_milestone.rb6
3 files changed, 8 insertions, 1 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index cbe65d70997..8f99e3bef9b 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -27,7 +27,7 @@ class Milestone < ActiveRecord::Base
belongs_to :project
has_many :issues
- has_many :labels, through: :issues
+ has_many :labels, -> { distinct.reorder('labels.title') }, through: :issues
has_many :merge_requests
has_many :participants, through: :issues, source: :assignee
diff --git a/features/project/milestone.feature b/features/project/milestone.feature
index e0f4c0e9d7c..713f0f3b979 100644
--- a/features/project/milestone.feature
+++ b/features/project/milestone.feature
@@ -13,6 +13,7 @@ Feature: Project Milestone
Given I visit project "Shop" milestones page
And I click link "v2.2"
Then I should see the labels "bug", "enhancement" and "feature"
+ And I should see the "bug" label listed only once
@javascript
Scenario: Listing labels from labels tab
diff --git a/features/steps/project/project_milestone.rb b/features/steps/project/project_milestone.rb
index ec881c0d8fc..2508c09e36d 100644
--- a/features/steps/project/project_milestone.rb
+++ b/features/steps/project/project_milestone.rb
@@ -41,6 +41,12 @@ class Spinach::Features::ProjectMilestone < Spinach::FeatureSteps
end
end
+ step 'I should see the "bug" label listed only once' do
+ page.within('#tab-labels') do
+ expect(page).to have_content('bug', count: 1)
+ end
+ end
+
step 'I click link "v2.2"' do
click_link "v2.2"
end