Commit 8df63d15 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Update specs to accomodate issuable assign changes

parent 4adfd501
...@@ -100,7 +100,7 @@ describe Issues::BulkUpdateService, services: true do ...@@ -100,7 +100,7 @@ describe Issues::BulkUpdateService, services: true do
describe :update_milestone do describe :update_milestone do
before do before do
@milestone = create :milestone @milestone = create(:milestone, project: @project)
@params = { @params = {
issues_ids: [issue.id], issues_ids: [issue.id],
milestone_id: @milestone.id milestone_id: @milestone.id
......
...@@ -6,31 +6,31 @@ describe Issues::CreateService, services: true do ...@@ -6,31 +6,31 @@ describe Issues::CreateService, services: true do
let(:assignee) { create(:user) } let(:assignee) { create(:user) }
describe :execute do describe :execute do
let(:issue) { Issues::CreateService.new(project, user, opts).execute }
context 'valid params' do context 'valid params' do
before do before do
project.team << [user, :master] project.team << [user, :master]
project.team << [assignee, :master] project.team << [assignee, :master]
end
opts = { let(:opts) do
title: 'Awesome issue', { title: 'Awesome issue',
description: 'please fix', description: 'please fix',
assignee: assignee assignee: assignee }
}
@issue = Issues::CreateService.new(project, user, opts).execute
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 'creates a pending todo for new assignee' do it 'creates a pending todo for new assignee' do
attributes = { attributes = {
project: project, project: project,
author: user, author: user,
user: assignee, user: assignee,
target_id: @issue.id, target_id: issue.id,
target_type: @issue.class.name, target_type: issue.class.name,
action: Todo::ASSIGNED, action: Todo::ASSIGNED,
state: :pending state: :pending
} }
...@@ -39,8 +39,8 @@ describe Issues::CreateService, services: true do ...@@ -39,8 +39,8 @@ describe Issues::CreateService, services: true do
end end
context 'label that belongs to different project' do context 'label that belongs to different project' do
let(:issue) { Issues::CreateService.new(project, user, opts).execute }
let(:label) { create(:label) } let(:label) { create(:label) }
let(:opts) do let(:opts) do
{ title: 'Title', { title: 'Title',
description: 'Description', description: 'Description',
...@@ -53,15 +53,15 @@ describe Issues::CreateService, services: true do ...@@ -53,15 +53,15 @@ describe Issues::CreateService, services: true do
end end
context 'milestone that belongs to different project' do context 'milestone that belongs to different project' do
let(:issue) { Issues::CreateService.new(project, user, opts).execute }
let(:milestone) { create(:milestone) } let(:milestone) { create(:milestone) }
let(:opts) do let(:opts) do
{ title: 'Title', { title: 'Title',
description: 'Description', description: 'Description',
milestone_id: milestone.id } milestone_id: milestone.id }
end end
it 'does not assign label' do it 'does not assign milestone' do
expect(issue.milestone).to_not eq milestone expect(issue.milestone).to_not eq milestone
end end
end end
......
...@@ -4,10 +4,15 @@ describe Issues::UpdateService, services: true do ...@@ -4,10 +4,15 @@ describe Issues::UpdateService, services: true do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
let(:issue) { create(:issue, title: 'Old title', assignee_id: user3.id) } let(:project) { create(:empty_project) }
let(:label) { create(:label) } let(:label) { create(:label, project: project) }
let(:label2) { create(:label) } let(:label2) { create(:label) }
let(:project) { issue.project }
let(:issue) do
create(:issue, title: 'Old title',
assignee_id: user3.id,
project: project)
end
before do before do
project.team << [user, :master] project.team << [user, :master]
......
require 'spec_helper' require 'spec_helper'
describe MergeRequests::UpdateService, services: true do describe MergeRequests::UpdateService, services: true do
let(:project) { create(:project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:user3) { create(:user) } let(:user3) { create(:user) }
let(:merge_request) { create(:merge_request, :simple, title: 'Old title', assignee_id: user3.id) } let(:label) { create(:label, project: project) }
let(:project) { merge_request.project }
let(:label) { create(:label) }
let(:label2) { create(:label) } let(:label2) { create(:label) }
let(:merge_request) do
create(:merge_request, :simple, title: 'Old title',
assignee_id: user3.id,
source_project: project)
end
before do before do
project.team << [user, :master] project.team << [user, :master]
project.team << [user2, :developer] project.team << [user2, :developer]
......
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