This is a sample source code on how you do unit testing for models in Sinatra app
- Ruby
2.5.3
You can install it using rbenv.
If you prefer another version of ruby, you are free to change it to any version you want.
It controlled via file .ruby_version
, you can either change it manually or execute:
$ rbenv local <version> # e.g rbenv local 2.5.3
- Bundler
2.1.4
You can install via Gem. For example:
$ gem install bundler -v 2.1.4
- Docker
You can install it via this link
- Installing libraries (or we called it gems)
Open this project directory, execute this command below:
$ bundle config --local set path 'vendor/bundle'
$ bundle install
- Provisioning needed services
Open this project directory, execute this command below:
$ docker-compose up -d
It will run containers with installed mysql and database schema.
To stop it, execute:
$ docker-compose down
Open this project directory, execute this command below:
$ bundle exec rspec -fd