How To Load Data From Seed & Rake Tasks

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

    - cp config/ config/database.yml
    - bundle exec rake db:create db:migrate db:seed permissions:permissions --trace

config/ is a file that holds my test settings as

   adapter: postgresql
   database: app_test
   pool: 5

permissions:load_permissions is my rake task that loads permissions.

Please refer CircleCI configuration

One thought on “How To Load Data From Seed & Rake Tasks

  1. Excellent excited synthetic attention designed for details and
    can anticipate problems just before these people happen.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.