Created
June 11, 2015 19:57
-
-
Save gkop/e6cd075fe2d41780ba27 to your computer and use it in GitHub Desktop.
seeds_spec.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
describe "seeds.rb script" do | |
def count_all_tables | |
ActiveRecord::Base.descendants | |
.sort_by(&:to_s).map(&:count) | |
end | |
it "is idempotent" do | |
load Rails.root.join("db", "seeds.rb") | |
counts = count_all_tables | |
load Rails.root.join("db", "seeds.rb") | |
expect(count_all_tables).to eq(counts) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment