{"id":15512498,"url":"https://github.com/conversation/rspec-queue","last_synced_at":"2025-10-12T09:31:28.183Z","repository":{"id":56892947,"uuid":"43850663","full_name":"conversation/rspec-queue","owner":"conversation","description":null,"archived":false,"fork":false,"pushed_at":"2020-04-27T11:47:47.000Z","size":38,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-08T04:58:38.462Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/conversation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-07T23:31:20.000Z","updated_at":"2024-02-28T16:31:02.000Z","dependencies_parsed_at":"2022-08-20T16:10:38.838Z","dependency_job_id":null,"html_url":"https://github.com/conversation/rspec-queue","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/conversation/rspec-queue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conversation%2Frspec-queue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conversation%2Frspec-queue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conversation%2Frspec-queue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conversation%2Frspec-queue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/conversation","download_url":"https://codeload.github.com/conversation/rspec-queue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/conversation%2Frspec-queue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010939,"owners_count":26084837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:53:40.813Z","updated_at":"2025-10-12T09:31:27.855Z","avatar_url":"https://github.com/conversation.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# rspec-queue\n\nA parallel test runner specifically for rspec.\n\nThe main difference between this and similar gems is that it spawns entirely new worker processes instead of forking. This makes configuring the workers easier (especially when Rails is involved) as many things will \"just work\".\n\nIt's intended to work with RSpec \u003e= 3.2. It may work with earlier versions, but I doubt it.\n\n## Usage\nPut it in your Gemfile, bundle, and you're away.\n\n```ruby\ngem 'rspec-queue'\n```\n\nIf you need isolated databases, you'll need to ensure they are prepared before attempting to run any tests.\n\nAdd any configuration needed for each worker to your `spec_helper` file.\n\n```ruby\nRSpecQueue::Configuration.after_worker_spawn do |index|\n  # Establish connection to an isolated database\n  ActiveRecord::Base.configurations['test']['database'] \u003c\u003c index.to_s\n  ActiveRecord::Base.establish_connection(:test)\nend\n```\n\nRunning tests via rspec-queue is the same as running them via rspec.\n\n```sh\nbundle exec rspec-queue spec\n```\n\nBy default, rspec-queue will spawn a number of workers equal to one less than the count of your total cpus. You can override this behaviour by setting the `RSPEC_QUEUE_WORKERS` environment variable.\n\n```sh\nRSPEC_QUEUE_WORKERS=6 bundle exec rspec-queue spec\n```\n\n## Potential Issues\n\nIf you're doing some form of acceptance testing you'll probably want to use xvfb to isolate the browsers for each worker so they don't do annoying things like steal focus from each other. This can cause many headaches trying to debug strange failures!\n\nFortunately, there's a gem for that: https://github.com/leonid-shevtsov/headless\n\nYou can then add some extra configuration in the `after_worker_spawn` block to use a different display for each worker:\n\n```ruby\nRSpecQueue::Configuration.after_worker_spawn do |index|\n  # ...\n  Headless.new(display: 100 + index.to_i, reuse: true, destroy_at_exit: true).start\nend\n```\n\nIf you're using Rails with page caching in test, you probably want to isolate the public folders for each worker. This should probably be done in your test environment configuration. It should be as easy as making a copy of your public folder for each worker.\n\n```ruby\n# test.rb\nRails.application.configure do\n  # ...\n\n  # RSPEC_QUEUE_WORKER_ID is a unique identifier for the current worker\n  if ENV[\"RSPEC_QUEUE_WORKER_ID\"]\n    # copy the public directory to a distinct folder\n    master_public_path = Rails.root.join(\"public\")\n    worker_root_path = Rails.root.join(\"tmp\", \"rspec-queue\", ENV[\"RSPEC_QUEUE_WORKER_ID\"])\n    FileUtils.mkdir_p worker_root_path\n    FileUtils.cp_r master_public_path, worker_root_path\n    worker_public_path = worker_root_path.join(\"public\")\n\n    # point rails to the new directory\n    config.paths[\"public\"] = worker_public_path\n    config.action_controller.page_cache_directory = worker_public_path\n  end\nend\n```\n\nSetting a distinct public folder can also assist with issues that arise when uploading files in acceptance tests.\n\n## Things that aren't great\n\nThe way the formatting works isn't great. It was hacked together in a rush and extracted from an existing codebase as is. It unfortunately means that this gem won't work with any formatter that isn't it's own. The way the formatter is set in the rspec-queue binary is also not ideal and will likely cause issues with certain setups.\n\nAt the moment, the worker passes some lo-fi results to the server over the unix socket, but not the full set of example results that most formatters use and expect. To deal with this we use our custom formatter that only needs basic information.\n\nHowever, if we want to use another formatter, we would need to reconstruct much more information, which is difficult to marshal/unmarshal, and if we try to do this manually we risk coupling ourselves to a particular rspec version's internals.\n\nThe plan is to fix that so it will work just fine with any formatter and make the configuration more sensible, but right now, it is how it is.\n\n---\n\nMIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconversation%2Frspec-queue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconversation%2Frspec-queue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconversation%2Frspec-queue/lists"}