Skip to content

Commit

Permalink
Add a test to ensure that an empty database remains empty
Browse files Browse the repository at this point in the history
Only the schema itself should change
  • Loading branch information
bdunne committed Aug 7, 2018
1 parent 664512e commit 7b1d5e1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/automated_review/empty_database_spec.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7b1d5e1

Please sign in to comment.