Logo: Relish

  1. Sign in

Project: Active-sanity

Check sanity

As a developer
In order to ensure that existing records are valid
I want to run 'rake db:check_sanity' and see which records are invalid

Background
Given
I have a rails app using 'active_sanity'
Scenarios
Check sanity on empty database
When
I run "rake db:check_sanity"
Then
I should see "Checking the following models: Category, InvalidRecord, Post, User"
Then
I should not see any invalid records
Check sanity on database with valid records
Given
the database contains a few valid records
When
I run "rake db:check_sanity"
Then
I should not see any invalid records
Check sanity on database with invalid records
Given
the database contains a few valid records
And
the first author's username is empty and the first post category_id is nil
When
I run "rake db:check_sanity"
Then
I should see the following invalid records:
User 1 {:username=>["can't be blank", "is too short (minimum is 3 characters)"]}
Post 1 {:category=>["can't be blank"]}

Last published over 4 years ago by johngrimes.