diff --git a/spec/automated_review/empty_database_spec.rb b/spec/automated_review/empty_database_spec.rb new file mode 100644 index 000000000..5de49e2ac --- /dev/null +++ b/spec/automated_review/empty_database_spec.rb @@ -0,0 +1,11 @@ +describe "Empty Database" do + it "after migrated remains empty" do + counts = ApplicationRecord.connection.tables.each_with_object([]) do |t, array| + next if ManageIQ::Schema::SYSTEM_TABLES.include?(t) + count = ApplicationRecord.connection.execute("SELECT COUNT(*) FROM #{t};").getvalue(0, 0) + array << "#{t}: #{count}" if count.positive? + end + + expect(counts.size).to eq(0), "Records were found in the following tables:\n#{counts.join("\n")}" + end +end