blob: e90d56cfeefc7837a68d0b0ecaeca49817be1032 (
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
47
48
49
50
51
52
53
54
55
56
|
# frozen_string_literal: true
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20191015154408_drop_merge_requests_require_code_owner_approval_from_projects.rb')
describe DropMergeRequestsRequireCodeOwnerApprovalFromProjects, :migration do
let(:projects_table) { table(:projects) }
subject(:migration) { described_class.new }
describe "without running the migration" do
it "project_table has a :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.to include("merge_requests_require_code_owner_approval")
end
it "project_table has a :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.to include("projects_requiring_code_owner_approval")
end
end
describe '#up' do
context "without running "
before do
migrate!
end
it "drops the :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.not_to include("merge_requests_require_code_owner_approval")
end
it "drops the :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.not_to include("projects_requiring_code_owner_approval")
end
end
describe "#down" do
before do
migration.up
migration.down
end
it "project_table has a :merge_requests_require_code_owner_approval column" do
expect(projects_table.column_names)
.to include("merge_requests_require_code_owner_approval")
end
it "project_table has a :projects_requiring_code_owner_approval index" do
expect(ActiveRecord::Base.connection.indexes(:projects).collect(&:name))
.to include("projects_requiring_code_owner_approval")
end
end
end
|