version: 2
jobs:
  build:
    working_directory: ~/package-tracker
    docker:
      - image: circleci/ruby:2.4.1-node
        environment:
          RAILS_ENV: test
      - image: circleci/postgres:9.4.12-alpine
    steps:
      - checkout

      # Restore bundle cache
      - type: cache-restore
        key: package-tracker-{{ checksum "Gemfile.lock" }}

      # Bundle install dependencies
      - run: bundle install --path vendor/bundle

      # Store bundle cache
      - type: cache-save
        key: package-tracker-{{ checksum "Gemfile.lock" }}
        paths:
          - vendor/bundle

      # Database setup
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load

      # Run rspec in parallel
#      - type: shell
#        command: |
#          bundle exec rspec --profile 10 \
#                            --format RspecJunitFormatter \
#                            --out /tmp/test-results/rspec.xml \
#                            --format progress \
#                            $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
      - type: shell
        command: bundle exec rubocop

      # Save artifacts
      - type: store_test_results
        path: /tmp/test-results


version: 2
jobs:
  build:
    working_directory: ~/package-tracker
    docker:
      - image: circleci/ruby:2.4.0-node
        environment:
          RAILS_ENV: test
      - image: circleci/postgres:9.4.12-alpine
    steps:
      - checkout

      # Restore bundle cache
      - type: cache-restore
        key: package-tracker-{{ checksum "Gemfile.lock" }}

      # Bundle install dependencies
      - run: bundle install --path vendor/bundle

      # Store bundle cache
      - type: cache-save
        key: package-tracker-{{ checksum "Gemfile.lock" }}
        paths:
          - vendor/bundle

      # Database setup
      - run: bundle exec rake db:create
      - run: bundle exec rake db:schema:load

      # Run rspec in parallel
#      - type: shell
#        command: |
#          bundle exec rspec --profile 10 \
#                            --format RspecJunitFormatter \
#                            --out /tmp/test-results/rspec.xml \
#                            --format progress \
#                            $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
      - type: shell
        command: bundle exec rubocop

      # Save artifacts
      - type: store_test_results
        path: /tmp/test-results


Fix ruby version in Circleci file
Fix ruby version in Circleci file
