CircleCI generates its own database.yml for every build. It then creates the database using the newly created database.yml file and loads the schema. It sets the environment to ‘test’ and runs the test cases.
I needed some data that was loaded using seed and a rake task. This data was preserved from truncation between test cases. The problem was that Circle didn’t use migrations and seeding but used schema loading and hence all the test cases were failing.
To solve the issue, i added a circle.yml to application folder root with the following contents
database: override: - cp config/database.yml.ci config/database.yml - bundle exec rake db:create db:migrate db:seed permissions:permissions --trace
config/database.yml.ci is a file that holds my test settings as
test: adapter: postgresql database: app_test pool: 5 username: password:
permissions:load_permissions is my rake task that loads permissions.
Please refer https://circleci.com/docs/configuration CircleCI configuration