Last active
August 27, 2015 17:30
-
-
Save amar47shah/db8c0829c64c51455274 to your computer and use it in GitHub Desktop.
Test for clean database between specs
This file contains 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
# spec/clean_database_spec.rb | |
require 'rails_helper' | |
describe 'Checking for clean database' do | |
specify 'no data to start with' do | |
[ | |
# your model classes | |
].each do |model| | |
expect(model.count).to be_zero | |
end | |
end | |
end |
This file contains 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
# test_db_clean.sh | |
bundle exec rspec -fd $1 | |
bundle exec rspec -fd spec/clean_database_spec.rb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
run all specs with something like: