diff options
author | Sean McGivern <sean@gitlab.com> | 2017-08-03 14:50:06 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-08-07 13:55:00 +0300 |
commit | 149528f472f3d2f3865ae01c764b81c6a97f9380 (patch) | |
tree | 8c9e38e7071b0a0002d3741259a7318e7a0427e5 /spec/helpers/milestones_routing_helper_spec.rb | |
parent | 03b816f3e845c9b25d3588336fc1616238465deb (diff) |
Support references to group milestones
Group milestones can only be referred to by name, not IID. They also do not
support cross-project references.
Diffstat (limited to 'spec/helpers/milestones_routing_helper_spec.rb')
-rw-r--r-- | spec/helpers/milestones_routing_helper_spec.rb | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/helpers/milestones_routing_helper_spec.rb b/spec/helpers/milestones_routing_helper_spec.rb new file mode 100644 index 00000000000..dc13a43c2ab --- /dev/null +++ b/spec/helpers/milestones_routing_helper_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +describe MilestonesRoutingHelper do + let(:project) { build_stubbed(:project) } + let(:group) { build_stubbed(:group) } + + describe '#milestone_path' do + context 'for a group milestone' do + let(:milestone) { build_stubbed(:milestone, group: group, iid: 1) } + + it 'links to the group milestone page' do + expect(milestone_path(milestone)) + .to eq(group_milestone_path(group, milestone)) + end + end + + context 'for a project milestone' do + let(:milestone) { build_stubbed(:milestone, project: project, iid: 1) } + + it 'links to the project milestone page' do + expect(milestone_path(milestone)) + .to eq(project_milestone_path(project, milestone)) + end + end + end + + describe '#milestone_url' do + context 'for a group milestone' do + let(:milestone) { build_stubbed(:milestone, group: group, iid: 1) } + + it 'links to the group milestone page' do + expect(milestone_url(milestone)) + .to eq(group_milestone_url(group, milestone)) + end + end + + context 'for a project milestone' do + let(:milestone) { build_stubbed(:milestone, project: project, iid: 1) } + + it 'links to the project milestone page' do + expect(milestone_url(milestone)) + .to eq(project_milestone_url(project, milestone)) + end + end + end +end |