2017-01-06 07:47:18 -05:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2017-07-10 10:24:02 -04:00
|
|
|
describe GroupMilestone do
|
2017-01-06 07:47:18 -05:00
|
|
|
let(:group) { create(:group) }
|
2017-08-02 15:55:11 -04:00
|
|
|
let(:project) { create(:project, group: group) }
|
2017-01-06 07:47:18 -05:00
|
|
|
let(:project_milestone) do
|
|
|
|
create(:milestone, title: "Milestone v1.2", project: project)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe '.build' do
|
|
|
|
it 'returns milestone with group assigned' do
|
2017-07-25 13:09:00 -04:00
|
|
|
milestone = described_class.build(
|
2017-01-06 07:47:18 -05:00
|
|
|
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
|
2017-07-25 13:09:00 -04:00
|
|
|
milestones = described_class.build_collection(group, [project], {})
|
2017-01-06 07:47:18 -05:00
|
|
|
expect(milestones).to all(have_attributes(group: group))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|