This repository was archived by the owner on Sep 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
spec/support/macros/database Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,15 @@ user.errors.full_messages
164164# ]
165165```
166166
167+ ## Development
168+
169+ The tests require a database. We've provided a simple ` docker-compose.yml ` that will make
170+ it trivial to run the tests against PostgreSQL. Simply run ` docker compose up -d `
171+ followed by ` rake spec ` . When you're done, run ` docker compose down ` to stop the database.
172+
173+ In order to use another database, simply define the ` DATABASE_URL ` environment variable
174+ appropriately.
175+
167176## License
168177
169178` ActiveRecord::JSONValidator ` is © 2013-2022 [ Mirego] ( https://www.mirego.com ) and may be freely distributed under the [ New BSD license] ( https://opensource.org/licenses/BSD-3-Clause ) . See the [ ` LICENSE.md ` ] ( https://github.com/mirego/activerecord_json_validator/blob/master/LICENSE.md ) file.
Original file line number Diff line number Diff line change 1+ version : ' 3.2'
2+
3+ services :
4+ postgres :
5+ image : postgres:10
6+ ports :
7+ - 5432:5432
8+ restart : on-failure
9+ environment :
10+ POSTGRES_DB : activerecord_json_validator_test
11+ POSTGRES_HOST_AUTH_METHOD : trust # don't require password
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ def initialize(opts = {})
66 end
77
88 def establish_connection!
9- ActiveRecord ::Base . establish_connection ( ENV [ 'DATABASE_URL' ] )
9+ ActiveRecord ::Base . establish_connection ( ENV . fetch ( 'DATABASE_URL' , 'postgres://postgres@localhost/activerecord_json_validator_test' ) )
1010 end
1111end
You can’t perform that action at this time.
0 commit comments