blob: cea72003ccd7d0977f44ee6ea14571291d9b4d98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# frozen_string_literal: true
require 'spec_helper'
require_migration!
RSpec.describe CleanupMrAttentionRequestTodos, :migration, feature_category: :code_review_workflow do
let(:projects) { table(:projects) }
let(:namespaces) { table(:namespaces) }
let(:users) { table(:users) }
let(:todos) { table(:todos) }
let(:author) { users.create!(projects_limit: 1) }
let(:namespace) { namespaces.create!(name: 'test', path: 'test') }
let(:project) do
projects.create!(
namespace_id: namespace.id,
project_namespace_id: namespace.id,
name: 'test-project'
)
end
let(:attention_requested) { 10 }
let(:todo_attrs) do
{
project_id: project.id,
author_id: author.id,
user_id: author.id,
target_type: 'TestType',
state: 'pending'
}
end
let!(:todo1) { todos.create!(todo_attrs.merge(action: Todo::ASSIGNED)) }
let!(:todo2) { todos.create!(todo_attrs.merge(action: Todo::MENTIONED)) }
let!(:todo3) { todos.create!(todo_attrs.merge(action: Todo::REVIEW_REQUESTED)) }
let!(:todo4) { todos.create!(todo_attrs.merge(action: attention_requested)) }
let!(:todo5) { todos.create!(todo_attrs.merge(action: attention_requested)) }
describe '#up' do
it 'clean up attention request todos' do
expect { migrate! }.to change(todos, :count).by(-2)
expect(todos.all).to include(todo1, todo2, todo3)
end
end
end
|