Commit 974ec3ca authored by Valery Sizov's avatar Valery Sizov

[Multiple issue assignees] specs fix

parent 7311b53a
......@@ -34,7 +34,7 @@ describe Projects::Boards::IssuesController do
issue = create(:labeled_issue, project: project, labels: [planning])
create(:labeled_issue, project: project, labels: [planning])
create(:labeled_issue, project: project, labels: [development], due_date: Date.tomorrow)
create(:labeled_issue, project: project, labels: [development], assignee: johndoe)
create(:labeled_issue, project: project, labels: [development], assignees: [johndoe])
issue.subscribe(johndoe, project)
list_issues user: user, board: board, list: list2
......
......@@ -336,7 +336,7 @@ describe Projects::IssuesController do
let(:admin) { create(:admin) }
let!(:issue) { create(:issue, project: project) }
let!(:unescaped_parameter_value) { create(:issue, :confidential, project: project, author: author) }
let!(:request_forgery_timing_attack) { create(:issue, :confidential, project: project, assignee: assignee) }
let!(:request_forgery_timing_attack) { create(:issue, :confidential, project: project, assignees: [assignee]) }
describe 'GET #index' do
it 'does not list confidential issues for guests' do
......
......@@ -1329,7 +1329,7 @@ describe Projects::MergeRequestsController do
end
it 'correctly pluralizes flash message on success' do
issue2.update!(assignee: user)
issue2.update!(assignees: [user])
post_assign_issues
......
......@@ -32,7 +32,7 @@ describe "Dashboard Issues Feed", feature: true do
end
context "issue with basic fields" do
let!(:issue2) { create(:issue, author: user, assignee: assignee, project: project2, description: 'test desc') }
let!(:issue2) { create(:issue, author: user, assignees: [assignee], project: project2, description: 'test desc') }
it "renders issue fields" do
visit issues_dashboard_path(:atom, private_token: user.private_token)
......@@ -51,7 +51,7 @@ describe "Dashboard Issues Feed", feature: true do
context "issue with label and milestone" do
let!(:milestone1) { create(:milestone, project: project1, title: 'v1') }
let!(:label1) { create(:label, project: project1, title: 'label1') }
let!(:issue1) { create(:issue, author: user, assignee: assignee, project: project1, milestone: milestone1) }
let!(:issue1) { create(:issue, author: user, assignees: [assignee], project: project1, milestone: milestone1) }
before do
issue1.labels << label1
......
......@@ -6,7 +6,7 @@ describe 'Issues Feed', feature: true do
let!(:assignee) { create(:user, email: 'private2@example.com', public_email: 'public2@example.com') }
let!(:group) { create(:group) }
let!(:project) { create(:project) }
let!(:issue) { create(:issue, author: user, assignee: assignee, project: project) }
let!(:issue) { create(:issue, author: user, assignees: [assignee], project: project) }
before do
project.team << [user, :developer]
......
......@@ -98,7 +98,7 @@ describe 'Issue Boards add issue modal filtering', :feature, :js do
end
context 'assignee' do
let!(:issue) { create(:issue, project: project, assignee: user2) }
let!(:issue) { create(:issue, project: project, assignees: [user2]) }
before do
project.team << [user2, :developer]
......
......@@ -11,7 +11,7 @@ describe 'Issue Boards', feature: true, js: true do
let!(:bug) { create(:label, project: project, name: 'Bug') }
let!(:regression) { create(:label, project: project, name: 'Regression') }
let!(:stretch) { create(:label, project: project, name: 'Stretch') }
let!(:issue1) { create(:labeled_issue, project: project, assignee: user, milestone: milestone, labels: [development], relative_position: 2) }
let!(:issue1) { create(:labeled_issue, project: project, assignees: [user], milestone: milestone, labels: [development], relative_position: 2) }
let!(:issue2) { create(:labeled_issue, project: project, labels: [development, stretch], relative_position: 1) }
let(:board) { create(:board, project: project) }
let!(:list) { create(:list, board: board, label: development, position: 0) }
......
......@@ -7,7 +7,7 @@ describe 'Navigation bar counter', feature: true, js: true, caching: true do
let(:merge_request) { create(:merge_request, source_project: project) }
before do
issue.update(assignee: user)
issue.assignees = [user]
merge_request.update(assignee: user)
login_as(user)
end
......@@ -17,7 +17,7 @@ describe 'Navigation bar counter', feature: true, js: true, caching: true do
expect_counters('issues', '1')
issue.update(assignee: nil)
issue.assignees = []
visit issues_dashboard_path
expect_counters('issues', '1')
......
......@@ -11,7 +11,7 @@ RSpec.describe 'Dashboard Issues', feature: true do
let!(:authored_issue) { create :issue, author: current_user, project: project }
let!(:authored_issue_on_public_project) { create :issue, author: current_user, project: public_project }
let!(:assigned_issue) { create :issue, assignee: current_user, project: project }
let!(:assigned_issue) { create :issue, assignees: [current_user], project: project }
let!(:other_issue) { create :issue, project: project }
before do
......
......@@ -10,8 +10,8 @@ describe "Dashboard Issues filtering", feature: true, js: true do
project.team << [user, :master]
login_as(user)
create(:issue, project: project, author: user, assignee: user)
create(:issue, project: project, author: user, assignee: user, milestone: milestone)
create(:issue, project: project, author: user, assignees: [user])
create(:issue, project: project, author: user, assignees: [user], milestone: milestone)
visit_issues
end
......
......@@ -52,11 +52,11 @@ describe "GitLab Flavored Markdown", feature: true do
before do
@other_issue = create(:issue,
author: @user,
assignee: @user,
assignees: [@user],
project: project)
@issue = create(:issue,
author: @user,
assignee: @user,
assignees: [@user],
project: project,
title: "fix #{@other_issue.to_reference}",
description: "ask #{fred.to_reference} for details")
......
......@@ -7,7 +7,7 @@ describe 'Awards Emoji', feature: true do
let!(:user) { create(:user) }
let(:issue) do
create(:issue,
assignee: @user,
assignees: [@user],
project: project)
end
......
......@@ -31,7 +31,7 @@ describe 'Filter issues weight', js: true, feature: true do
title: 'Bug report 1',
milestone: milestone,
author: user,
assignee: user)
assignees: [user])
issue.labels << label
visit namespace_project_issues_path(project.namespace, project)
......
......@@ -9,7 +9,7 @@ describe 'New/edit issue', feature: true, js: true do
let!(:milestone) { create(:milestone, project: project) }
let!(:label) { create(:label, project: project) }
let!(:label2) { create(:label, project: project) }
let!(:issue) { create(:issue, project: project, assignee: user, milestone: milestone) }
let!(:issue) { create(:issue, project: project, assignees: [user], milestone: milestone) }
before do
project.team << [user, :master]
......
......@@ -101,7 +101,7 @@ feature 'Multiple issue updating from issues#index', feature: true do
end
def create_assigned
create(:issue, project: project, assignee: user)
create(:issue, project: project, assignees: [user])
end
def create_with_milestone
......
......@@ -19,7 +19,7 @@ describe 'Issues', feature: true do
let!(:issue) do
create(:issue,
author: @user,
assignee: @user,
assignees: [@user],
project: project)
end
......@@ -44,7 +44,7 @@ describe 'Issues', feature: true do
let!(:issue) do
create(:issue,
author: @user,
assignee: @user,
assignees: [@user],
project: project)
end
......@@ -139,7 +139,7 @@ describe 'Issues', feature: true do
describe 'Issue info' do
it 'excludes award_emoji from comment count' do
issue = create(:issue, author: @user, assignee: @user, project: project, title: 'foobar')
issue = create(:issue, author: @user, assignees: [@user], project: project, title: 'foobar')
create(:award_emoji, awardable: issue)
visit namespace_project_issues_path(project.namespace, project, assignee_id: @user.id)
......@@ -165,14 +165,14 @@ describe 'Issues', feature: true do
%w(foobar barbaz gitlab).each do |title|
create(:issue,
author: @user,
assignee: @user,
assignees: [@user],
project: project,
title: title)
end
@issue = Issue.find_by(title: 'foobar')
@issue.milestone = create(:milestone, project: project)
@issue.assignee = nil
@issue.assignees = []
@issue.save
end
......@@ -408,7 +408,7 @@ describe 'Issues', feature: true do
end
describe 'update labels from issue#show', js: true do
let(:issue) { create(:issue, project: project, author: @user, assignee: @user) }
let(:issue) { create(:issue, project: project, author: @user, assignees: [@user]) }
let!(:label) { create(:label, project: project) }
before do
......@@ -426,7 +426,7 @@ describe 'Issues', feature: true do
end
describe 'update assignee from issue#show' do
let(:issue) { create(:issue, project: project, author: @user, assignee: @user) }
let(:issue) { create(:issue, project: project, author: @user, assignees: [@user]) }
context 'by authorized user' do
it 'allows user to select unassigned', js: true do
......@@ -668,7 +668,7 @@ describe 'Issues', feature: true do
describe 'due date' do
context 'update due on issue#show', js: true do
let(:issue) { create(:issue, project: project, author: @user, assignee: @user) }
let(:issue) { create(:issue, project: project, author: @user, assignees: [@user]) }
before do
visit namespace_project_issue_path(project.namespace, project, issue)
......
......@@ -5,10 +5,10 @@ describe 'Milestone show', feature: true do
let(:project) { create(:empty_project) }
let(:milestone) { create(:milestone, project: project) }
let(:labels) { create_list(:label, 2, project: project) }
let(:issue_params) { { project: project, assignee: user, author: user, milestone: milestone, labels: labels } }
let(:issue_params) { { project: project, assignees: [user], author: user, milestone: milestone, labels: labels } }
before do
project.add_user(user, :developer)
project.add_user(user, :developer)
login_as(user)
end
......
......@@ -14,7 +14,7 @@ feature 'issuable templates', feature: true, js: true do
context 'user creates an issue using templates' do
let(:template_content) { 'this is a test "bug" template' }
let(:longtemplate_content) { %Q(this\n\n\n\n\nis\n\n\n\n\na\n\n\n\n\nbug\n\n\n\n\ntemplate) }
let(:issue) { create(:issue, author: user, assignee: user, project: project) }
let(:issue) { create(:issue, author: user, assignees: [user], project: project) }
let(:description_addition) { ' appending to description' }
background do
......@@ -74,7 +74,7 @@ feature 'issuable templates', feature: true, js: true do
context 'user creates an issue using templates, with a prior description' do
let(:prior_description) { 'test issue description' }
let(:template_content) { 'this is a test "bug" template' }
let(:issue) { create(:issue, author: user, assignee: user, project: project) }
let(:issue) { create(:issue, author: user, assignees: [user], project: project) }
background do
project.repository.create_file(
......
......@@ -6,7 +6,7 @@ describe "Search", feature: true do
let(:user) { create(:user) }
let(:project) { create(:project, namespace: user.namespace) }
let!(:issue) { create(:issue, project: project, assignee: user) }
let!(:issue) { create(:issue, project: project, assignees: [user]) }
let!(:issue2) { create(:issue, project: project, author: user) }
before do
......
......@@ -7,12 +7,12 @@ describe IssuesFinder do
let(:project2) { create(:empty_project) }
let(:milestone) { create(:milestone, project: project1) }
let(:label) { create(:label, project: project2) }
let(:issue1) { create(:issue, author: user, assignee: user, project: project1, milestone: milestone, title: 'gitlab') }
let(:issue2) { create(:issue, author: user, assignee: user, project: project2, description: 'gitlab') }
let(:issue3) { create(:issue, author: user2, assignee: user2, project: project2) }
let(:issue1) { create(:issue, author: user, assignees: [user], project: project1, milestone: milestone, title: 'gitlab') }
let(:issue2) { create(:issue, author: user, assignees: [user], project: project2, description: 'gitlab') }
let(:issue3) { create(:issue, author: user2, assignees: [user2], project: project2) }
describe '#execute' do
let(:closed_issue) { create(:issue, author: user2, assignee: user2, project: project2, state: 'closed') }
let(:closed_issue) { create(:issue, author: user2, assignees: [user2], project: project2, state: 'closed') }
let!(:label_link) { create(:label_link, label: label, target: issue2) }
let(:search_user) { user }
let(:params) { {} }
......@@ -107,7 +107,7 @@ describe IssuesFinder do
before do
milestones.each do |milestone|
create(:issue, project: milestone.project, milestone: milestone, author: user, assignee: user)
create(:issue, project: milestone.project, milestone: milestone, author: user, assignees: [user])
end
end
......@@ -142,7 +142,7 @@ describe IssuesFinder do
before do
milestones.each do |milestone|
create(:issue, project: milestone.project, milestone: milestone, author: user, assignee: user)
create(:issue, project: milestone.project, milestone: milestone, author: user, assignees: [user])
end
end
......
......@@ -100,7 +100,7 @@ describe Gitlab::Elastic::ProjectSearchResults, lib: true do
let(:admin) { create(:admin) }
let!(:issue) { create(:issue, project: project, title: 'Issue 1') }
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignee: assignee) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignees: [assignee]) }
before do
Gitlab::Elastic::Helper.refresh_index
......
......@@ -89,9 +89,9 @@ describe Gitlab::Elastic::SearchResults, lib: true do
before do
@issue = create(:issue, project: project_1, title: 'Issue 1', iid: 1)
@security_issue_1 = create(:issue, :confidential, project: project_1, title: 'Security issue 1', author: author, iid: 2)
@security_issue_2 = create(:issue, :confidential, title: 'Security issue 2', project: project_1, assignee: assignee, iid: 3)
@security_issue_2 = create(:issue, :confidential, title: 'Security issue 2', project: project_1, assignees: [assignee], iid: 3)
@security_issue_3 = create(:issue, :confidential, project: project_2, title: 'Security issue 3', author: author, iid: 1)
@security_issue_4 = create(:issue, :confidential, project: project_3, title: 'Security issue 4', assignee: assignee, iid: 1)
@security_issue_4 = create(:issue, :confidential, project: project_3, title: 'Security issue 4', assignees: [assignee], iid: 1)
@security_issue_5 = create(:issue, :confidential, project: project_4, title: 'Security issue 5', iid: 1)
Gitlab::Elastic::Helper.refresh_index
......
......@@ -189,7 +189,7 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
end
def setup_project
issue = create(:issue, assignee: user)
issue = create(:issue, assignees: [user])
snippet = create(:project_snippet)
release = create(:release)
group = create(:group)
......
......@@ -86,7 +86,7 @@ describe Gitlab::ProjectSearchResults, lib: true do
let(:project) { create(:empty_project, :internal) }
let!(:issue) { create(:issue, project: project, title: 'Issue 1') }
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignee: assignee) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignees: [assignee]) }
it 'does not list project confidential issues for non project members' do
results = described_class.new(non_member, project, query)
......
......@@ -72,9 +72,9 @@ describe Gitlab::SearchResults do
let(:admin) { create(:admin) }
let!(:issue) { create(:issue, project: project_1, title: 'Issue 1') }
let!(:security_issue_1) { create(:issue, :confidential, project: project_1, title: 'Security issue 1', author: author) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project_1, assignee: assignee) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project_1, assignees: [assignee]) }
let!(:security_issue_3) { create(:issue, :confidential, project: project_2, title: 'Security issue 3', author: author) }
let!(:security_issue_4) { create(:issue, :confidential, project: project_3, title: 'Security issue 4', assignee: assignee) }
let!(:security_issue_4) { create(:issue, :confidential, project: project_3, title: 'Security issue 4', assignees: [assignee]) }
let!(:security_issue_5) { create(:issue, :confidential, project: project_4, title: 'Security issue 5') }
it 'does not list confidential issues for non project members' do
......
......@@ -57,21 +57,6 @@ describe Issue, "Issuable" do
end
end
describe 'assignee_name' do
it 'is delegated to assignee' do
issue.update!(assignee: create(:user))
expect(issue.assignee_name).to eq issue.assignee.name
end
it 'returns nil when assignee is nil' do
issue.assignee_id = nil
issue.save(validate: false)
expect(issue.assignee_name).to eq nil
end
end
describe "before_save" do
describe "#update_cache_counts" do
context "when previous assignee exists" do
......
......@@ -11,13 +11,13 @@ describe Milestone, 'Milestoneish' do
let(:milestone) { create(:milestone, project: project) }
let!(:issue) { create(:issue, project: project, milestone: milestone) }
let!(:security_issue_1) { create(:issue, :confidential, project: project, author: author, milestone: milestone) }
let!(:security_issue_2) { create(:issue, :confidential, project: project, assignee: assignee, milestone: milestone) }
let!(:security_issue_2) { create(:issue, :confidential, project: project, assignees: [assignee], milestone: milestone) }
let!(:closed_issue_1) { create(:issue, :closed, project: project, milestone: milestone) }
let!(:closed_issue_2) { create(:issue, :closed, project: project, milestone: milestone) }
let!(:closed_security_issue_1) { create(:issue, :confidential, :closed, project: project, author: author, milestone: milestone) }
let!(:closed_security_issue_2) { create(:issue, :confidential, :closed, project: project, assignee: assignee, milestone: milestone) }
let!(:closed_security_issue_2) { create(:issue, :confidential, :closed, project: project, assignees: [assignee], milestone: milestone) }
let!(:closed_security_issue_3) { create(:issue, :confidential, :closed, project: project, author: author, milestone: milestone) }
let!(:closed_security_issue_4) { create(:issue, :confidential, :closed, project: project, assignee: assignee, milestone: milestone) }
let!(:closed_security_issue_4) { create(:issue, :confidential, :closed, project: project, assignees: [assignee], milestone: milestone) }
let!(:merge_request) { create(:merge_request, source_project: project, target_project: project, milestone: milestone) }
before do
......
......@@ -92,8 +92,8 @@ describe Event, models: true do
let(:author) { create(:author) }
let(:assignee) { create(:user) }
let(:admin) { create(:admin) }
let(:issue) { create(:issue, project: project, author: author, assignee: assignee) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignee: assignee) }
let(:issue) { create(:issue, project: project, author: author, assignees: [assignee]) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignees: [assignee]) }
let(:note_on_commit) { create(:note_on_commit, project: project) }
let(:note_on_issue) { create(:note_on_issue, noteable: issue, project: project) }
let(:note_on_confidential_issue) { create(:note_on_issue, noteable: confidential_issue, project: project) }
......
......@@ -166,7 +166,7 @@ describe Issue, models: true do
describe '#is_being_reassigned?' do
it 'returns issues assigned to user' do
user = create(:user)
create_list(:issue, 2, assignee: user)
create_list(:issue, 2, assignees: [user])
expect(Issue.open_for(user).count).to eq 2
end
......@@ -399,7 +399,7 @@ describe Issue, models: true do
it 'updates when assignees change' do
user1 = create(:user)
user2 = create(:user)
issue = create(:issue, assignee: user1)
issue = create(:issue, assignees: [user1])
expect(user1.assigned_open_issues_count).to eq(1)
expect(user2.assigned_open_issues_count).to eq(0)
......
......@@ -15,7 +15,7 @@ describe IssuePolicy, models: true do
context 'a private project' do
let(:non_member) { create(:user) }
let(:project) { create(:empty_project, :private) }
let(:issue) { create(:issue, project: project, assignee: assignee, author: author) }
let(:issue) { create(:issue, project: project, assignees: [assignee], author: author) }
let(:issue_no_assignee) { create(:issue, project: project) }
before do
......@@ -69,7 +69,7 @@ describe IssuePolicy, models: true do
end
context 'with confidential issues' do
let(:confidential_issue) { create(:issue, :confidential, project: project, assignee: assignee, author: author) }
let(:confidential_issue) { create(:issue, :confidential, project: project, assignees: [assignee], author: author) }
let(:confidential_issue_no_assignee) { create(:issue, :confidential, project: project) }
it 'does not allow non-members to read confidential issues' do
......@@ -110,7 +110,7 @@ describe IssuePolicy, models: true do
context 'a public project' do
let(:project) { create(:empty_project, :public) }
let(:issue) { create(:issue, project: project, assignee: assignee, author: author) }
let(:issue) { create(:issue, project: project, assignees: [assignee], author: author) }
let(:issue_no_assignee) { create(:issue, project: project) }
before do
......@@ -157,7 +157,7 @@ describe IssuePolicy, models: true do
end
context 'with confidential issues' do
let(:confidential_issue) { create(:issue, :confidential, project: project, assignee: assignee, author: author) }
let(:confidential_issue) { create(:issue, :confidential, project: project, assignees: [assignee], author: author) }
let(:confidential_issue_no_assignee) { create(:issue, :confidential, project: project) }
it 'does not allow guests to read confidential issues' do
......
......@@ -15,7 +15,7 @@ describe API::Issues, api: true do
let!(:closed_issue) do
create :closed_issue,
author: user,
assignee: user,
assignees: [user],
project: project,
state: :closed,
milestone: milestone,
......@@ -27,14 +27,14 @@ describe API::Issues, api: true do
:confidential,
project: project,
author: author,
assignee: assignee,
assignees: [assignee],
created_at: generate(:issue_created_at),
updated_at: 2.hours.ago
end
let!(:issue) do
create :issue,
author: user,
assignee: user,
assignees: [user],
project: project,
milestone: milestone,
created_at: generate(:issue_created_at),
......@@ -296,7 +296,7 @@ describe API::Issues, api: true do
let!(:group_closed_issue) do
create :closed_issue,
author: user,
assignee: user,
assignees: [user],
project: group_project,
state: :closed,
milestone: group_milestone,
......@@ -307,13 +307,13 @@ describe API::Issues, api: true do
:confidential,
project: group_project,
author: author,
assignee: assignee,
assignees: [assignee],
updated_at: 2.hours.ago
end
let!(:group_issue) do
create :issue,
author: user,
assignee: user,
assignees: [user],
project: group_project,
milestone: group_milestone,
updated_at: 1.hour.ago
......
......@@ -15,7 +15,7 @@ describe API::V3::Issues, api: true do
let!(:closed_issue) do
create :closed_issue,
author: user,
assignee: user,
assignees: [user],
project: project,
state: :closed,
milestone: milestone,
......@@ -27,14 +27,14 @@ describe API::V3::Issues, api: true do
:confidential,
project: project,
author: author,
assignee: assignee,
assignees: [assignee],
created_at: generate(:issue_created_at),
updated_at: 2.hours.ago
end
let!(:issue) do
create :issue,
author: user,
assignee: user,
assignees: [user],
project: project,
milestone: milestone,
created_at: generate(:issue_created_at),
......@@ -248,7 +248,7 @@ describe API::V3::Issues, api: true do
let!(:group_closed_issue) do
create :closed_issue,
author: user,
assignee: user,
assignees: [user],
project: group_project,
state: :closed,
milestone: group_milestone,
......@@ -259,13 +259,13 @@ describe API::V3::Issues, api: true do
:confidential,
project: group_project,
author: author,
assignee: assignee,
assignees: [assignee],
updated_at: 2.hours.ago
end
let!(:group_issue) do
create :issue,
author: user,
assignee: user,
assignees: [user],
project: group_project,
milestone: group_milestone,
updated_at: 1.hour.ago
......
......@@ -4,7 +4,7 @@ describe Issues::CloseService, services: true do
let(:user) { create(:user) }
let(:user2) { create(:user) }
let(:guest) { create(:user) }
let(:issue) { create(:issue, assignee: user2) }
let(:issue) { create(:issue, assignees: [user2]) }
let(:project) { issue.project }
let!(:todo) { create(:todo, :assigned, user: user, project: project, target: issue, author: user2) }
......
......@@ -196,7 +196,7 @@ describe Issues::UpdateService, services: true do
context 'when is reassigned' do
before do
update_issue(assignee: user2)
update_issue(assignees: [user2])
end
it 'marks previous assignee todos as done' do
......
......@@ -16,7 +16,7 @@ describe MergeRequests::AssignIssuesService, services: true do
end
it 'ignores issues already assigned to any user' do
issue.update!(assignee: create(:user))
issue.assignees = [create(:user)]
expect(service.assignable_issues).to be_empty
end
......@@ -44,7 +44,7 @@ describe MergeRequests::AssignIssuesService, services: true do
end
it 'assigns these to the merge request owner' do
expect { service.execute }.to change { issue.reload.assignee }.to(user)
expect { service.execute }.to change { issue.assignees.first }.to(user)
end
it 'ignores external issues' do
......
......@@ -11,7 +11,7 @@ describe Projects::AutocompleteService, services: true do
let(:project) { create(:empty_project, :public) }
let!(:issue) { create(:issue, project: project, title: 'Issue 1') }
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignee: assignee) }
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignees: [assignee]) }
it 'does not list project confidential issues for guests' do
autocomplete = described_class.new(project, nil)
......
......@@ -22,11 +22,11 @@ describe TodoService, services: true do
end
describe 'Issues' do
let(:issue) { create(:issue, project: project, assignee: john_doe, author: author, description: "- [ ] Task 1\n- [ ] Task 2 #{mentions}") }
let(:addressed_issue) { create(:issue, project: project, assignee: john_doe, author: author, description: "#{directly_addressed}\n- [ ] Task 1\n- [ ] Task 2") }
let(:unassigned_issue) { create(:issue, project: project, assignee: nil) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignee: assignee, description: mentions) }
let(:addressed_confident_issue) { create(:issue, :confidential, project: project, author: author, assignee: assignee, description: directly_addressed) }
let(:issue) { create(:issue, project: project, assignees: [john_doe], author: author, description: "- [ ] Task 1\n- [ ] Task 2 #{mentions}") }
let(:addressed_issue) { create(:issue, project: project, assignees: [john_doe], author: author, description: "#{directly_addressed}\n- [ ] Task 1\n- [ ] Task 2") }
let(:unassigned_issue) { create(:issue, project: project, assignees: []) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignees: [assignee], description: mentions) }
let(:addressed_confident_issue) { create(:issue, :confidential, project: project, author: author, assignees: [assignee], description: directly_addressed) }
describe '#new_issue' do
it 'creates a todo if assigned' do
......@@ -40,7 +40,7 @@ describe TodoService, services: true do
end
it 'creates a todo if assignee is the current user' do
unassigned_issue.update_attribute(:assignee, john_doe)
unassigned_issue.assignees = [john_doe]
service.new_issue(unassigned_issue, john_doe)
should_create_todo(user: john_doe, target: unassigned_issue, author: john_doe, action: Todo::ASSIGNED)
......@@ -343,7 +343,7 @@ describe TodoService, services: true do
describe '#new_note' do
let!(:first_todo) { create(:todo, :assigned, user: john_doe, project: project, target: issue, author: author) }
let!(:second_todo) { create(:todo, :assigned, user: john_doe, project: project, target: issue, author: author) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignee: assignee) }
let(:confidential_issue) { create(:issue, :confidential, project: project, author: author, assignees: [assignee]) }
let(:note) { create(:note, project: project, noteable: issue, author: john_doe, note: mentions) }
let(:addressed_note) { create(:note, project: project, noteable: issue, author: john_doe, note: directly_addressed) }
let(:note_on_commit) { create(:note_on_commit, project: project, author: john_doe, note: mentions) }
......@@ -783,7 +783,7 @@ describe TodoService, services: true do
end
it 'updates cached counts when a todo is created' do
issue = create(:issue, project: project, assignee: john_doe, author: author, description: mentions)
issue = create(:issue, project: project, assignees: [john_doe], author: author, description: mentions)
expect(john_doe.todos_pending_count).to eq(0)
expect(john_doe).to receive(:update_todos_count_cache).and_call_original
......@@ -795,8 +795,8 @@ describe TodoService, services: true do
end
describe '#mark_todos_as_done' do
let(:issue) { create(:issue, project: project, author: author, assignee: john_doe) }
let(:another_issue) { create(:issue, project: project, author: author, assignee: john_doe) }
let(:issue) { create(:issue, project: project, author: author, assignees: [john_doe]) }
let(:another_issue) { create(:issue, project: project, author: author, assignees: [john_doe]) }
it 'marks a relation of todos as done' do
create(:todo, :mentioned, user: john_doe, target: issue, project: project)
......
......@@ -10,7 +10,7 @@ module ExportFileHelper
create(:release, project: project)
issue = create(:issue, assignee: user, project: project)
issue = create(:issue, assignees: [user], project: project)
snippet = create(:project_snippet, project: project)
label = create(:label, project: project)
milestone = create(:milestone, project: project)
......
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