Today I Learned

Running heavy specs on CircleCI on demand

We have some specs that we do want to run only once a day (smoke specs that connect to actual live services). To handle this case we have introduced following setup:

.rspec

#...
--exclude-pattern "spec/smoke/*_spec.rb"

.circleci/config.yml

- run:
    name: run specs
    command: |
      if [[ ${RUN_ALL_TESTS} == "true" ]]; then
        bundle exec rspec --format progress --exclude-pattern ""
      else
        bundle exec rspec --format progress
      fi

This way we can control if some specs are excluded or not, using ENV variable. You can then trigger such build on demand or use CircleCI Workflows.