{"id":15046925,"url":"https://github.com/rstacruz/rspec-repeat","last_synced_at":"2025-09-14T07:31:04.537Z","repository":{"id":56892957,"uuid":"43076629","full_name":"rstacruz/rspec-repeat","owner":"rstacruz","description":"Repeats an RSpec example until it succeeds.","archived":false,"fork":false,"pushed_at":"2024-04-26T15:29:24.000Z","size":22,"stargazers_count":24,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-03T10:38:17.660Z","etag":null,"topics":["rails","rspec"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstacruz.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-24T15:47:55.000Z","updated_at":"2021-05-21T13:20:47.000Z","dependencies_parsed_at":"2024-06-19T02:18:11.927Z","dependency_job_id":"49ec5ba7-5d33-4bc3-a54a-8908dd15ff8a","html_url":"https://github.com/rstacruz/rspec-repeat","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/rstacruz/rspec-repeat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstacruz%2Frspec-repeat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstacruz%2Frspec-repeat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstacruz%2Frspec-repeat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstacruz%2Frspec-repeat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstacruz","download_url":"https://codeload.github.com/rstacruz/rspec-repeat/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstacruz%2Frspec-repeat/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275076531,"owners_count":25401314,"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-09-14T02:00:10.474Z","response_time":75,"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":["rails","rspec"],"created_at":"2024-09-24T20:53:45.678Z","updated_at":"2025-09-14T07:31:04.220Z","avatar_url":"https://github.com/rstacruz.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RSpec::Repeat\n\n\u003e Repeats an RSpec example until it succeeds\n\n```rb\n# spec_helper.rb\n\n# Example: Repeat all tests in CI\nif ENV['CI']\n  require 'rspec/repeat'\n\n  RSpec.configure do |config|\n    config.include RSpec::Repeat\n    config.around :each do |example|\n      repeat example, 3.times, verbose: true\n    end\n  end\nend\n```\n[![Status](https://travis-ci.org/rstacruz/rspec-repeat.svg?branch=master)](https://travis-ci.org/rstacruz/rspec-repeat \"See test builds\")\n\n\u003cbr\u003e\n\n## Advanced usage\n\n### Options\n\n```\nrepeat example, 3.times, { options }\n```\n\nYou can pass an `options` hash:\n\n- __clear_let__ *(Boolean)* — if *false*, `let` declarations will not be cleared.\n- __exceptions__ *(Array)* — if given, it will only retry exception classes from this list.\n- __wait__ *(Numeric)* — seconds to wait between each retry.\n- __verbose__ *(Boolean)* — if *true*, it will print messages upon failure.\n\n### Attaching to tags\n\nThis will allow you to repeat any example multiple times by tagging it.\n\n```rb\n# rails_helper.rb or spec_helper.rb\nrequire 'rspec/repeat'\n\nRSpec.configure do |config|\n  config.include RSpec::Repeat\n  config.around :each, :stubborn do |example|\n    repeat example, 3.times\n  end\nend\n```\n\n```rb\ndescribe 'stubborn tests', :stubborn do\n  # ...\nend\n```\n\n### Attaching to features\n\nThis will make all `spec/features/` retry thrice. Perfect for Poltergeist/Selenium tests that intermittently fail for no reason.\n\n```rb\n# rails_helper.rb or spec_helper.rb\nrequire 'rspec/repeat'\n\nRSpec.configure do |config|\n  config.include RSpec::Repeat\n  config.around :each, type: :feature do |example|\n    repeat example, 3.times\n  end\nend\n```\n\nIn these cases, it'd be smart to restrict which exceptions to be retried.\n\n```rb\nrepeat example, 3.times, verbose: true, exceptions: [\n  Net::ReadTimeout,\n  Selenium::WebDriver::Error::WebDriverError\n]\n```\n\n### Repeating a specific test\n\nYou can also include RSpec::Repeat in just a single test block.\n\n```rb\nrequire 'rspec/repeat'\n\ndescribe 'a stubborn test' do\n  include RSpec::Repeat\n\n  around do |example|\n    repeat example, 10.times\n  end\n\n  it 'works, eventually' do\n    expect(rand(2)).to eq 0\n  end\nend\n```\n\n\u003cbr\u003e\n\n## Acknowledgement\n\nMuch of this code has been refactored out of [rspec-retry](https://github.com/NoRedInk/rspec-retry) by [@NoRedInk](https://github.com/NoRedInk).\n\n\u003cbr\u003e\n\n## Thanks\n\n**rspec-repeat** © 2015-2017, Rico Sta. Cruz. Released under the [MIT] License.\u003cbr\u003e\nAuthored and maintained by Rico Sta. Cruz with help from contributors ([list][contributors]).\n\n\u003e [ricostacruz.com](http://ricostacruz.com) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e GitHub [@rstacruz](https://github.com/rstacruz) \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter [@rstacruz](https://twitter.com/rstacruz)\n\n[MIT]: http://mit-license.org/\n[contributors]: http://github.com/rstacruz/rspec-repeat/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstacruz%2Frspec-repeat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstacruz%2Frspec-repeat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstacruz%2Frspec-repeat/lists"}