{"id":18481599,"url":"https://github.com/rubocop/capybara-style-guide","last_synced_at":"2026-02-28T05:52:49.269Z","repository":{"id":216163888,"uuid":"740475223","full_name":"rubocop/capybara-style-guide","owner":"rubocop","description":"A community-driven Capybara coding style guide","archived":false,"fork":false,"pushed_at":"2025-03-18T16:51:21.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-13T19:56:18.133Z","etag":null,"topics":["capybara","rubocop","ruby","styleguide"],"latest_commit_sha":null,"homepage":"https://rubocop.github.io/capybara-style-guide/","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/rubocop.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null},"funding":{"github":"bbatsov","patreon":"bbatsov","open_collective":"rubocop","tidelift":"rubygems/rubocop","custom":"https://www.paypal.me/bbatsov"}},"created_at":"2024-01-08T12:26:12.000Z","updated_at":"2025-03-18T16:52:30.000Z","dependencies_parsed_at":"2024-01-11T12:03:30.872Z","dependency_job_id":"bef854e2-a322-4487-8326-acdc694147cf","html_url":"https://github.com/rubocop/capybara-style-guide","commit_stats":null,"previous_names":["rubocop/capybara-style-guide"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rubocop/capybara-style-guide","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubocop%2Fcapybara-style-guide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubocop%2Fcapybara-style-guide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubocop%2Fcapybara-style-guide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubocop%2Fcapybara-style-guide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubocop","download_url":"https://codeload.github.com/rubocop/capybara-style-guide/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubocop%2Fcapybara-style-guide/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29925847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T19:37:42.220Z","status":"online","status_checked_at":"2026-02-28T02:00:07.010Z","response_time":90,"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":["capybara","rubocop","ruby","styleguide"],"created_at":"2024-11-06T12:24:32.033Z","updated_at":"2026-02-28T05:52:49.235Z","avatar_url":"https://github.com/rubocop.png","language":"Ruby","funding_links":["https://github.com/sponsors/bbatsov","https://patreon.com/bbatsov","https://opencollective.com/rubocop","https://tidelift.com/funding/github/rubygems/rubocop","https://www.paypal.me/bbatsov","https://www.patreon.com/bbatsov"],"categories":[],"sub_categories":[],"readme":"= Capybara Style Guide\n:idprefix:\n:idseparator: -\n:sectanchors:\n:sectlinks:\n:toc: preamble\n:toclevels: 1\nifndef::backend-pdf[]\n:toc-title: pass:[\u003ch2\u003eTable of Contents\u003c/h2\u003e]\nendif::[]\n:source-highlighter: rouge\n\n== Introduction\n\n[quote, Officer Alex J. Murphy / RoboCop]\n____\nRole models are important.\n____\n\nifdef::env-github[]\nTIP: You can find a beautiful version of this guide with much improved navigation at https://capybara.rubystyle.guide.\nendif::[]\n\nThis Capybara style guide outlines the recommended best practices for real-world programmers to write code that can be maintained by other real-world programmers.\n\nhttps://github.com/rubocop/rubocop[RuboCop], a static code analyzer (linter) and formatter, has a https://github.com/rubocop/rubocop-capybara[`rubocop-capybara`] extension, provides a way to enforce the rules outlined in this guide.\n\nYou can generate a PDF copy of this guide using https://asciidoctor.org/docs/asciidoctor-pdf/[AsciiDoctor PDF], and an HTML copy https://asciidoctor.org/docs/convert-documents/#converting-a-document-to-html[with] https://asciidoctor.org/#installation[AsciiDoctor] using the following commands:\n\n[source,shell]\n----\n# Generates README.pdf\nasciidoctor-pdf -a allow-uri-read README.adoc\n\n# Generates README.html\nasciidoctor README.adoc\n----\n\n[TIP]\n====\nInstall the `rouge` gem to get nice syntax highlighting in the generated document.\n\n[source,shell]\n----\ngem install rouge\n----\n====\n\n== A Living Document\n\nThis guide is work in progress - trying to fill in the arguments by which the rubocop-capbyara cops were written so that users can understand the tradeoffs on different approaches (whether to configure, enable or disable different cops)  and understand where it's a question of consistency and/or style, or are there other issues at play.\n\n== Using Capybara\n\n=== Use a specific click_link or click_button to surface accessibility issues[[click-link-or-button-specificity]]\n(corresponds to Capybara/ClickLinkOrButtonStyle)\n\n=== But if you do use a generic click then use a consistent method[[click-link-or-button-consistency]]\n(also corresponds to Capybara/ClickLinkOrButtonStyle)\n\n=== Don't set expectations on Capybara `current_path`\n(corresponds to Capybara/CurrentPathExpectation)\n\n=== Don't use deprecated style methods\n(corresponds to Capybara/MatchStyle)\n\n=== Either use of `have_no_*` or use `not_to` consistently for negated expectations[[negation-matcher-consistency]]\n(corresponds to Capybara/NegationMatcher)\n\n=== Be concise: don't use redundant withins[[no-redundant-within-finds]]\n(corresponds to Capybara/RedundantWithinFind)\n\n=== Be specific: Use the most specific action rather than a generic action with parameters.[[specific-action]]\n(corresponds to Capybara/SpecificActions)\n\n=== Be specific: Use the most specific finder rather than a generic finder with parameters[[specific-finder]]\n(corresponds to Capybara/SpecificFinders)\n\n=== Be specific: Use the most specific matcher rather than a generic matcher with parameters[[specific-matcher]]\n(corresponds to Capybara/SpecificMatcher)\n\n=== Don't use visible: false in Capybara finders, instead use a specific visibility symbol[[visibility-matcher-specificity]]\n(corresponds to Capybara/VisibilityMatcher)\n\n== Using Capybara with RSpec\n\n=== Use `have_css` or `have_xpath` instead of `have_selector`[[dont-use-have-selector]]\n(corresponds to Capybara/RSpec/HaveSelector)\n\n=== Prefer using predicate matcher over using predicate method directly[[predicate-matcher-rather-than-method]]\n(corresponds to Capybara/RSpec/PredicateMatcher)\n\n\n== Related Guides\n\n* https://rubystyle.guide[Ruby Style Guide]\n* https://rspec.rubystyle.guide[RSpec Style Guide]\n* https://rails.rubystyle.guide[Rails Style Guide]\n* https://minitest.rubystyle.guide[Minitest Style Guide]\n\n== Contributing\n\nNothing written in this guide is set in stone.\nEveryone is welcome to contribute, so that we could ultimately create a resource that will be beneficial to the entire Ruby community.\n\nFeel free to open tickets or send pull requests with improvements.\nThanks in advance for your help!\n\nYou can also support the project (and RuboCop) with financial contributions via https://www.patreon.com/bbatsov[Patreon].\n\n=== How to Contribute?\n\nIt's easy, just follow the contribution guidelines below:\n\n* https://docs.github.com/en/get-started/quickstart/fork-a-repo[Fork] the https://github.com/rubocop/rspec-style-guide[project] on GitHub\n* Make your feature addition or bug fix in a feature branch\n* Include a http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[good description] of your changes\n* Push your feature branch to GitHub\n* Send a https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests[Pull Request]\n\n== License\n\nimage:https://i.creativecommons.org/l/by/3.0/88x31.png[Creative Commons License]\nThis work is licensed under a http://creativecommons.org/licenses/by/3.0/deed.en_US[Creative Commons Attribution 3.0 Unported License]\n\n\n== Credit\n\nTBC!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubocop%2Fcapybara-style-guide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubocop%2Fcapybara-style-guide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubocop%2Fcapybara-style-guide/lists"}