summaryrefslogtreecommitdiff
path: root/spec/models/group_milestone_spec.rb
blob: 916afb7aaf5d982d28e53a5f1ee2d53a8f39c3bc (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
require 'spec_helper'

describe GroupMilestone, models: true do
  let(:group) { create(:group) }
  let(:project) { create(:empty_project, group: group) }
  let(:project_milestone) do
    create(:milestone, title: "Milestone v1.2", project: project)
  end

  describe '.build' do
    it 'returns milestone with group assigned' do
      milestone = GroupMilestone.build(
        group,
        [project],
        project_milestone.title
      )

      expect(milestone.group).to eq group
    end
  end

  describe '.build_collection' do
    before do
      project_milestone
    end

    it 'returns array of milestones, each with group assigned' do
      milestones = GroupMilestone.build_collection(group, [project], {})
      expect(milestones).to all(have_attributes(group: group))
    end
  end
end