diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-03 14:17:55 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-07-03 14:17:55 +0300 |
commit | 063b035d931d0676cf427fa8de49966360cbf42b (patch) | |
tree | 2b47a0aac0196a7fdbba66b716b7bb76f7d4a675 /spec/helpers | |
parent | 2443ab69206f7cbd9a6ac2e96308695a01b85c7a (diff) | |
parent | b8430dddbd413c87f77ba7f02d9b0a0cd4ec42ad (diff) |
Merge branch '34116-milestone-filtering-on-group-issues' into 'master'
Use correct milestones for filtering on Group Issues
Closes #34116
See merge request !12374
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/milestones_helper_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/helpers/milestones_helper_spec.rb b/spec/helpers/milestones_helper_spec.rb index 3cb809d42b5..24d4f1b4938 100644 --- a/spec/helpers/milestones_helper_spec.rb +++ b/spec/helpers/milestones_helper_spec.rb @@ -1,6 +1,42 @@ require 'spec_helper' describe MilestonesHelper do + describe '#milestones_filter_dropdown_path' do + let(:project) { create(:empty_project) } + let(:project2) { create(:empty_project) } + let(:group) { create(:group) } + + context 'when @project present' do + it 'returns project milestones JSON URL' do + assign(:project, project) + + expect(helper.milestones_filter_dropdown_path).to eq(namespace_project_milestones_path(project.namespace, project, :json)) + end + end + + context 'when @target_project present' do + it 'returns targeted project milestones JSON URL' do + assign(:target_project, project2) + + expect(helper.milestones_filter_dropdown_path).to eq(namespace_project_milestones_path(project2.namespace, project2, :json)) + end + end + + context 'when @group present' do + it 'returns group milestones JSON URL' do + assign(:group, group) + + expect(helper.milestones_filter_dropdown_path).to eq(group_milestones_path(group, :json)) + end + end + + context 'when neither of @project/@target_project/@group present' do + it 'returns dashboard milestones JSON URL' do + expect(helper.milestones_filter_dropdown_path).to eq(dashboard_milestones_path(:json)) + end + end + end + describe "#milestone_date_range" do def result_for(*args) milestone_date_range(build(:milestone, *args)) |