version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.2.0-node
    steps:
      - checkout
      # Restore bundle cache
      - restore_cache:
          key: gems-{{ checksum "Gemfile.lock" }}

      # copy env
      - run: cp .env.example .env

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

      # Store bundle cache
      - save_cache:
          key: gems-{{ checksum "Gemfile.lock" }}
          paths:
            - /tmp/vendor/bundle

      # run rubocop
      - type: shell
        command: |
          bundle exec rubocop

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

      # Save test results for timing analysis
      - store_test_results:
          path: test_results

version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.3.3-node
    steps:
      - checkout
      # Restore bundle cache
      - restore_cache:
          key: gems-{{ checksum "Gemfile.lock" }}

      # copy env
      - run: cp .env.example .env

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

      # Store bundle cache
      - save_cache:
          key: gems-{{ checksum "Gemfile.lock" }}
          paths:
            - /tmp/vendor/bundle

      # run rubocop
      - type: shell
        command: |
          bundle exec rubocop

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

      # Save test results for timing analysis
      - store_test_results:
          path: test_results

Revert "scale back ruby version"
Revert "scale back ruby version"

This reverts commit 23f55afab24be22471a6ebae26028d4bf4469379.
