diff options
Diffstat (limited to 'spec/migrations/add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb')
-rw-r--r-- | spec/migrations/add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/migrations/add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb b/spec/migrations/add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb new file mode 100644 index 00000000000..6fd3cb1f44e --- /dev/null +++ b/spec/migrations/add_not_null_constraint_to_project_mirror_data_foreign_key_spec.rb @@ -0,0 +1,18 @@ +require 'spec_helper' +require Rails.root.join('db', 'migrate', '20180508100222_add_not_null_constraint_to_project_mirror_data_foreign_key.rb') + +describe AddNotNullConstraintToProjectMirrorDataForeignKey, :migration do + let(:namespaces) { table(:namespaces) } + let(:projects) { table(:projects) } + let(:import_state) { table(:project_mirror_data) } + + before do + import_state.create!(id: 1, project_id: nil, status: :started) + end + + it 'removes every import state without an associated project_id' do + expect do + subject.up + end.to change { import_state.count }.from(1).to(0) + end +end |