Skip to content

Commit

Permalink
Update README instruction to run tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanTron committed Jan 5, 2024
1 parent 7957ecf commit 608630d
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,52 @@ database.

## Runnning tests

gem install bundler
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x bundle
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 bundle
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake

If you want to see what queries are executed:

DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x rake
DEBUG=true BUNDLE_GEMFILE=ci/Gemfile.rails-5.x-i18n-0.6 rake
```shell
# Create db for mysql tests
mysql -e 'create database i18n_sequel_bitemporal;' --host 127.0.0.1
# Create db for postgresql tests
createdb i18n_sequel_bitemporal

##
# Run tests for a specific Rails version
##
BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" bundle install
# MySQL
BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test
# PG
BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test
# Sqlite
BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test

##
# Run tests for a specific Rails version, logging all queries to stdout
##
BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" bundle install
# MySQL
DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test
# PG
DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test
# Sqlite
DEBUG=1 BUNDLE_GEMFILE="ci/Gemfile.rails-6.1" TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test

##
# Example to run tests for every supported Rails version.
# !! Some Rails versions are not compatible with all Ruby versions !!
##
for gemfile in (ls ci/Gemfile.rails-* | grep -v lock);
echo $gemfile
BUNDLE_GEMFILE=$gemfile bundle install

# MySQL
BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=mysql2 TEST_DATABASE=i18n_sequel_bitemporal TEST_ENCODING="utf8" bundle exec rake test

# PG
BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=postgresql TEST_DATABASE=i18n_sequel_bitemporal bundle exec rake test

# Sqlite
BUNDLE_GEMFILE=$gemfile TEST_ADAPTER=sqlite3 TEST_DATABASE=test/database.sqlite3 bundle exec rake test
end
```
## Maintainers
Expand Down

0 comments on commit 608630d

Please sign in to comment.