diff options
author | Takuya Noguchi <tak.noguchi.iridge@gmail.com> | 2017-06-22 10:19:43 +0300 |
---|---|---|
committer | Takuya Noguchi <tak.noguchi.iridge@gmail.com> | 2017-06-26 17:54:07 +0300 |
commit | 175b7834c398546550a75b545fa42828302d656c (patch) | |
tree | 1cfb39b80e52c4faedb3f23a27294c2a7226bbf4 /spec/helpers | |
parent | f0886918845f8292889db7e30033b7051147f3b0 (diff) |
Add tests for MilestonesHelper#milestones_filter_dropdown_path
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)) |