Run tests on multiple database configurations

This commit is contained in:
2026-04-27 17:38:49 +02:00
parent 3ac3a6f13c
commit dedea0246f
9 changed files with 167 additions and 21 deletions

View File

@@ -119,9 +119,10 @@ Contributing
### Gems
Apart from database adapter, install development and testing gems:
Install development and testing gems, including at least MySQL and SQLite
database adapters:
bundle config --local with mysql development test
bundle config --local with development test mysql sqlite
### Configuration
@@ -134,8 +135,9 @@ assets.
### Database
Grant database user privileges for development and test environments,
possibly with different Ruby versions:
Grant database user privileges for development and test environments. Example
below shows how to grant privileges to all databases which names start with
`fixinme-` on MySQL:
> mysql -p
mysql> create user `fixinme-dev`@localhost identified by '<some password>';
@@ -148,6 +150,10 @@ Starting application server in development environment:
bundle exec rails s -e development
Accessing database console when more than one test db is present:
bundle exec rails dbconsole -e test --db sqlite3
For running rake tasks, prepend command with environment:
RAILS_ENV=development bundle exec rails ...
@@ -160,14 +166,22 @@ Tests need to be run from within toplevel application directory:
bundle exec rails test:system
* system test(s) with seed/test name specified:
* system test(s) with seed or test name specified:
bundle exec rails test:system --seed 64690 --name test_add_unit
bundle exec rails test:system --include test_add_unit --seed 64690
* all tests from one file, with optional seed:
* all tests from one file, optionally with seed:
bundle exec rails test test/system/users_test.rb --seed 1234
* system tests for selected database configuration (if multiple present):
bundle exec rails test:system --include /^test_sqlite3_/
* single system test for all database configurations (if multiple present):
bundle exec rails test:system --include /^test_\\w+_add_unit$/
### Icons
Pictogrammers Material Design Icons: https://pictogrammers.com/library/mdi/