summaryrefslogtreecommitdiff
path: root/spec/helpers/timeboxes_routing_helper_spec.rb
blob: 952194b670465c3361ae9a6cc44a9afdcf0ab8cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe TimeboxesRoutingHelper 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