diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-09-24 10:49:45 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-09-24 10:49:45 +0000 |
commit | 513629f3467a740231fa531637f3577c41f8d1bf (patch) | |
tree | 70e92c1b80f2663525dbbc19ab38e994020245a9 /spec | |
parent | d4007fd4a618bad42aa187be9b7a0e9cc22aa006 (diff) | |
parent | 8499de19c9bca4c43378b8a9cf2b6705f9cab647 (diff) | |
download | gitlab-ce-513629f3467a740231fa531637f3577c41f8d1bf.tar.gz |
Merge branch 'gitlab-ce-milestone-tab-badges' into 'master'
Milestone tab badges
### What does this MR do?
Adds count badges to the tabs on the Milestone page to mirror the Issue page.
### Are there points in the code the reviewer needs to double check?
CSS: Padding was added to the `.milestone` element to make expired milestones look good.
### Why was this MR needed?
For consistency with other tabs
### What are the relevant issue numbers?
Closes #20114
### Screenshots (if relevant)
**Before**
<img src="/uploads/1f75853a863a9058ee409916b7ee4057/Screen_Shot_2016-07-22_at_13.22.20.png" width="362">
**After**
<img src="/uploads/8a058290850f571db249dd9b23f5138d/Screen_Shot_2016-07-22_at_13.21.58.png" width="303">


### Does this MR meet the acceptance criteria?
- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
- [x] Added for this feature/bug
- [x] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
See merge request !5946
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories/milestones.rb | 7 | ||||
-rw-r--r-- | spec/helpers/milestones_helper_spec.rb | 33 |
2 files changed, 39 insertions, 1 deletions
diff --git a/spec/factories/milestones.rb b/spec/factories/milestones.rb index e9e85962fe4..84da71ed6dc 100644 --- a/spec/factories/milestones.rb +++ b/spec/factories/milestones.rb @@ -3,10 +3,15 @@ FactoryGirl.define do title project + trait :active do + state "active" + end + trait :closed do - state :closed + state "closed" end + factory :active_milestone, traits: [:active] factory :closed_milestone, traits: [:closed] end end diff --git a/spec/helpers/milestones_helper_spec.rb b/spec/helpers/milestones_helper_spec.rb new file mode 100644 index 00000000000..28c2268f8d0 --- /dev/null +++ b/spec/helpers/milestones_helper_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe MilestonesHelper do + describe '#milestone_counts' do + let(:project) { FactoryGirl.create(:project) } + let(:counts) { helper.milestone_counts(project.milestones) } + + context 'when there are milestones' do + let!(:milestone_1) { FactoryGirl.create(:active_milestone, project: project) } + let!(:milestone_2) { FactoryGirl.create(:active_milestone, project: project) } + let!(:milestone_3) { FactoryGirl.create(:closed_milestone, project: project) } + + it 'returns the correct counts' do + expect(counts).to eq(opened: 2, closed: 1, all: 3) + end + end + + context 'when there are only milestones of one type' do + let!(:milestone_1) { FactoryGirl.create(:active_milestone, project: project) } + let!(:milestone_2) { FactoryGirl.create(:active_milestone, project: project) } + + it 'returns the correct counts' do + expect(counts).to eq(opened: 2, closed: 0, all: 2) + end + end + + context 'when there are no milestones' do + it 'returns the correct counts' do + expect(counts).to eq(opened: 0, closed: 0, all: 0) + end + end + end +end |