Permission Denied for Rails system test

I’m adding parallelism by adding 2 containers and splitting the test by timings data. Up until now, builds have been fine. But I am now getting a Permission Denied error for a specific Rails system test. I’m running a Rails 5.2 app and using minitest. Here is my circleci config:

version: 2
jobs:
  build:
    working_directory: ~/my_app
    parallelism: 2

    docker:
      - image: circleci/ruby:2.5-node-browsers
        environment:
          RAILS_ENV: test
          BUNDLE_JOBS: 3
          BUNDLE_RETRY: 3
          BUNDLE_PATH: vendor/bundle
          PGHOST: 127.0.0.1
          PGUSER: test_user

      - image: circleci/postgres:10.4-alpine
        environment:
          POSTGRES_USER: test_user
          POSTGRES_DB: my_app_test
          POSTGRES_PASSWORD: ""

      - image: circleci/redis:4

      - image: circleci/node:jessie-browsers

    steps:
      - checkout

      # Download and cache dependencies
      - restore_cache:
          keys:
          - v1-dependencies-{{ checksum "Gemfile.lock" }}
          # fallback to using the latest cache if no exact match is found
          - v1-dependencies-

      - run:
          name: Install mcrypt library
          command: sudo apt-get install libmcrypt-dev

      - run:
          name: Bundle Install
          command: bundle check || bundle install

      - save_cache:
          paths:
            - ./vendor/bundle
          key: v1-dependencies-{{ checksum "Gemfile.lock" }}

      - run:
          name: Copy secret files
          command: |
            cp config/database.yml.ci config/database.yml
      # Database setup
      # Waits until DB service is available, according to CircleCI docs:
      # https://circleci.com/docs/2.0/language-ruby/#config-walkthrough
      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m

      - run:
          name: Database Setup
          command: |
            bundle exec rake db:create
            bundle exec rake db:schema:load  

      - run:
          name: Create directy to store test results
          command: mkdir test/reports

      - run:
          name: Download Selenium
          command: curl -O http://selenium-release.storage.googleapis.com/3.5/selenium-server-standalone-3.5.3.jar

      - run:
          name: Start Selenium
          command: java -jar selenium-server-standalone-3.5.3.jar -log test-reports/selenium.log
          background: true

      # https://circleci.com/docs/2.0/parallelism-faster-jobs/#splitting-by-timings-data
      - run:
          name: Run Tests
          command: |
            bundle exec rake test
            bundle exec rake test:system TESTOPTS='--verbose'
            $(circleci tests glob "test/**/*_test.rb" | circleci tests split --split-by=timings)

      # https://circleci.com/docs/2.0/collect-test-data/#minitest
      - store_test_results:
          path: test/reports

The error I’m getting is:

101 runs, 565 assertions, 0 failures, 0 errors, 2 skips
/bin/bash: line 2: test/system/dashboard_test.rb: Permission denied
Exited with code 126

There aren’t any permission issues when not configuring for parallelism and setting the test output results.
What am I doing wrong?

I wonder if the command needs to do ruby <test>.rb rather than just <test>.rb? If so, perhaps there is a mode for that in the circleci command.

Personally, if I were splitting tests I wouldn’t bother with the circleci command - most test systems give you a way to run tests by file, folder, annotation tag, etc - you can then use the parallelism env vars to see which set to run.