Move assert_have_error to test_helper.rb
Tweak code style
Add tests for primary key creation