diff options
author | haseeb <haseebeqx@yahoo.com> | 2017-08-10 21:44:15 +0300 |
---|---|---|
committer | haseeb <haseebeqx@yahoo.com> | 2017-08-10 21:44:15 +0300 |
commit | 59d7ffad06828435e31c7ea09c97c4b79909ef77 (patch) | |
tree | 0b329eb65aae1f48629ecddc6a475666c463bcad /spec/services/merge_requests/create_from_issue_service_spec.rb | |
parent | a115267e25f8f2499156ea04bf1d9c0296b09270 (diff) |
tests for inheriting milestones and labels
Diffstat (limited to 'spec/services/merge_requests/create_from_issue_service_spec.rb')
-rw-r--r-- | spec/services/merge_requests/create_from_issue_service_spec.rb | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/spec/services/merge_requests/create_from_issue_service_spec.rb b/spec/services/merge_requests/create_from_issue_service_spec.rb index 492b55cdece..bdc53c7e64b 100644 --- a/spec/services/merge_requests/create_from_issue_service_spec.rb +++ b/spec/services/merge_requests/create_from_issue_service_spec.rb @@ -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 |