diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 15:06:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-21 15:06:40 +0300 |
commit | 0a6ffb540e569bd7a7c548d59b12bc55d4bf9cf1 (patch) | |
tree | 9ff7dd7b21a3f9642a8fbb45c922f71a433faf02 /spec/migrations | |
parent | a048261403ea7e12992ccffe704f0779235712d7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
-rw-r--r-- | spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb b/spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb new file mode 100644 index 00000000000..e90d56cfeef --- /dev/null +++ b/spec/migrations/20191015154408_drop_merge_requests_require_code_owner_approval_from_projects_spec.rb @@ -0,0 +1,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 |