Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackc/assert_db_rejects
Test database level constraints with ActiveRecord
https://github.com/jackc/assert_db_rejects
Last synced: 24 days ago
JSON representation
Test database level constraints with ActiveRecord
- Host: GitHub
- URL: https://github.com/jackc/assert_db_rejects
- Owner: jackc
- License: mit
- Created: 2009-11-15T02:55:45.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2009-11-15T04:16:50.000Z (almost 15 years ago)
- Last Synced: 2024-03-15T07:50:32.985Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 70.3 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: CHANGELOG
- License: MIT-LICENSE
Awesome Lists containing this project
README
AssertDbRejects
===============Test database level constraints with ActiveRecord.
Installation
============The gem is hosted on http://gemcutter.org.
config.gem 'assert_db_rejects'
Example
=======require 'test_helper'
class PersonTest < ActiveSupport::TestCase
test "database blocks duplicate names" do
Person.create!( :name => "Test" )
# Assume the people table has a not null constraint on name. The assertion
# will pass if a ActiveRecord::StatementInvalid is raised when saving p.
# Validations are bypassed by assert_db_rejects as the purpose is to test
# the database and not the model
assert_db_rejects( Person.new( :name => "Test" ) )
end
endLicense
=======Copyright (c) 2009 Jack Christensen, released under the MIT license