tests for inheriting milestones and labels
This commit is contained in:
parent
a115267e25
commit
59d7ffad06
1 changed files with 26 additions and 1 deletions
|
@ -4,8 +4,21 @@ describe MergeRequests::CreateFromIssueService do
|
|||
let(:project) { create(:project, :repository) }
|
||||
let(:user) { create(:user) }
|
||||
let(:issue) { create(:issue, project: project) }
|
||||
|
||||
let(:milestone) { create(:milestone, project: project) }
|
||||
let(:labels) { create_pair(:label, project: project) }
|
||||
|
||||
subject(:service) { described_class.new(project, user, issue_iid: issue.iid) }
|
||||
subject(:service2) do
|
||||
described_class.new(
|
||||
project,
|
||||
user,
|
||||
{
|
||||
issue_iid: issue.iid,
|
||||
milestone_id: milestone.id,
|
||||
label_ids: labels.map(&:id)
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
before do
|
||||
project.add_developer(user)
|
||||
|
@ -25,6 +38,18 @@ describe MergeRequests::CreateFromIssueService do
|
|||
described_class.new(project, user, issue_iid: -1).execute
|
||||
end
|
||||
|
||||
it "can inherit labels" do
|
||||
result = service2.execute
|
||||
|
||||
expect(result[:merge_request].label_ids).to eq(labels.map(&:id))
|
||||
end
|
||||
|
||||
it "can inherit milestones" do
|
||||
result = service2.execute
|
||||
|
||||
expect(result[:merge_request].milestone_id).to eq(milestone.id)
|
||||
end
|
||||
|
||||
it 'delegates the branch creation to CreateBranchService' do
|
||||
expect_any_instance_of(CreateBranchService).to receive(:execute).once.and_call_original
|
||||
|
||||
|
|
Loading…
Reference in a new issue