Add Ruby on Rails test example

This commit is contained in:
Alan Vardy
2019-10-02 15:29:57 -06:00
committed by GitHub
parent 50f3cc9f0b
commit 0662c7a33d

View File

@@ -42,6 +42,47 @@ jobs:
- run: ruby hello.rb
```
Ruby on Rails Testing:
```yaml
name: Rails Unit Tests
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
services:
db:
image: postgres:11
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v1
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
- name: Build and test with Rake
env:
PGHOST: 127.0.0.1
PGUSER: postgres
RAILS_ENV: test
run: |
sudo apt-get -yqq install libpq-dev
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec rails db:create
bundle exec rails db:migrate
bundle exec rails test
```
# License
The scripts and documentation in this project are released under the [MIT License](LICENSE)