The API server for the Code Test Bot application.
- Ruby 2.1.1
- PostgreSQL
The PostgreSQL app can be installed by downloading the app, or via homebrew cask: homebrew cask install postgres
.
To install the CLI Postgres use homebrew: homebrew install postgresql
. If you do this ensure that your locale is set correctly to UTF-8. This can be done by setting LC_ALL
to en_US.UTF-8
. If you don't do this then the database templates used to create new databases will be set up in ASCII mode and you will not be able to create th databases needed for this application.
User Bundler to install Gem dependencies.
bundle install
Make sure Postgres is running, you can do this by simply opening the application after downloading it. You should see the elephant logo in your menu bar on OSX. It should be running on the default port: 5432.
Make sure you have created at least one Postgres database:
createdb
Create a codetestbot
role for Postgres (-d gives permission to create databases):
createuser -d codetestbot
Then you can run Rake to create and seed the database.
bundle exec rake db:create db:migrate db:seed RAILS_ENV=development
bundle exec rake db:create db:migrate RAILS_ENV=test
Note that db:seed
is not called for the test environment, since rspec calls it prior to running each test.
Before you can successfully use CodeTestBot in conjunction with the client application (CodeTestBotApp), you'll need to set the yaml file expected by Figaro to configure your local environment. Rename config/application.yml.example to config/application.yml. If necessary, add a line to use the development token. Your settings should look like below:
development:
BASE_URI: http://localhost:3000
USE_DEV_TOKEN: "true"
Lastly, before running CodeTestBotApp, run CodeTestBotServer:
rails server
Once the test DB is setup, you should be able to run the tests with RSpec.
bundle exec rspec