Commit 006d8b26 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add affinity checks in issue create service

parent 8df63d15
...@@ -3,12 +3,15 @@ require 'spec_helper' ...@@ -3,12 +3,15 @@ require 'spec_helper'
describe Issues::CreateService, services: true do describe Issues::CreateService, services: true do
let(:project) { create(:empty_project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:assignee) { create(:user) }
describe :execute do describe :execute do
let(:issue) { Issues::CreateService.new(project, user, opts).execute } let(:issue) { Issues::CreateService.new(project, user, opts).execute }
context 'valid params' do context 'valid params' do
let(:assignee) { create(:user) }
let(:milestone) { create(:milestone, project: project) }
let(:labels) { create_list(:label, 4, project: project) }
before do before do
project.team << [user, :master] project.team << [user, :master]
project.team << [assignee, :master] project.team << [assignee, :master]
...@@ -17,12 +20,16 @@ describe Issues::CreateService, services: true do ...@@ -17,12 +20,16 @@ describe Issues::CreateService, services: true do
let(:opts) do let(:opts) do
{ title: 'Awesome issue', { title: 'Awesome issue',
description: 'please fix', description: 'please fix',
assignee: assignee } assignee: assignee,
label_ids: labels.map(&:id),
milestone_id: milestone.id }
end end
it { expect(issue).to be_valid } it { expect(issue).to be_valid }
it { expect(issue.title).to eq('Awesome issue') } it { expect(issue.title).to eq('Awesome issue') }
it { expect(issue.assignee).to eq assignee } it { expect(issue.assignee).to eq assignee }
it { expect(issue.labels).to match_array labels }
it { expect(issue.milestone).to eq milestone }
it 'creates a pending todo for new assignee' do it 'creates a pending todo for new assignee' do
attributes = { attributes = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment