{"id":16431395,"url":"https://github.com/stephencelis/rdoctest","last_synced_at":"2025-07-06T20:07:51.510Z","repository":{"id":1221739,"uuid":"1140943","full_name":"stephencelis/rdoctest","owner":"stephencelis","description":"A doctest for Ruby. Parses RDoc text for examples and tests them.","archived":false,"fork":false,"pushed_at":"2011-03-06T18:55:58.000Z","size":935,"stargazers_count":37,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-11T00:11:29.701Z","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":"glue-viz/glue","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stephencelis.png","metadata":{"files":{"readme":"README.rdoc","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}},"created_at":"2010-12-05T19:18:26.000Z","updated_at":"2024-08-17T12:18:18.000Z","dependencies_parsed_at":"2022-08-16T12:35:28.820Z","dependency_job_id":null,"html_url":"https://github.com/stephencelis/rdoctest","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/stephencelis/rdoctest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Frdoctest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Frdoctest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Frdoctest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Frdoctest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stephencelis","download_url":"https://codeload.github.com/stephencelis/rdoctest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stephencelis%2Frdoctest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263966169,"owners_count":23536814,"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","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-11T08:30:01.610Z","updated_at":"2025-07-06T20:07:51.489Z","avatar_url":"https://github.com/stephencelis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Rdoctest\n\nhttp://github.com/stephencelis/rdoctest\n\nA {doctest}[http://docs.python.org/py3k/library/doctest.html] for Ruby.\n\n\n== Why?\n\nYou'll improve your test coverage and documentation in one fell swoop.\n\n\n== How?\n\nInstall the gem:\n\n  % [sudo] gem install rdoctest\n\n\nUse the CLI:\n\n  % rdoctest lib/**/*.rb\n  Loaded suite /.../bin/rdoctest\n  Started\n  .\n  Finished in ... seconds.\n\n  1 tests, 6 assertions, 0 failures, 0 errors, 0 skips\n\n\n== Examples\n\n=== Formatting\n\nRdoctest expects well-formatted RDoc. This means:\n\n* Indent examples by 2 spaces.\n\n    # For example:\n    #\n    #   1 + 1 # This code is indented by 2 spaces.\n\n\n* If your example is a block of code, use \u003ctt\u003e# =\u003e\u003c/tt\u003e to designate the\n  expected result.\n\n    # Short blocks can have the result on the same line:\n    #\n    #   1 + 1 # =\u003e 2\n    #\n    # Longer blocks can have the result on the line following:\n    #\n    #   def hello_world\n    #     puts \"Hello, world!\"\n    #   end\n    #   # =\u003e nil\n\n\n* If your example is an IRB session, use \u003ctt\u003e\u003e\u003e\u003c/tt\u003e and \u003ctt\u003e=\u003e\u003c/tt\u003e\n  accordingly.\n\n    # Simple:\n    #\n    #   \u003e\u003e 1 + 1\n    #   =\u003e 2\n    #\n    # More complex, testing output:\n    #\n    #   \u003e\u003e def hello_world\n    #   \u003e\u003e   puts \"Hello, world!\"\n    #   \u003e\u003e end\n    #   =\u003e nil\n    #   \u003e\u003e hello_world\n    #   Hello, world!\n    #   =\u003e nil\n    #\n    # Use ellipses for partial matches:\n    #\n    #   \u003e\u003e goodbye_world\n    #   NameError: undefined local variable or method `goodbye_world'...\n\n\n=== CLI\n\nRdoctest's CLI works a lot like Ruby's.\n\n  % rdoctest -h\n  Usage: rdoctest [options] [file ...]\n      -Idirectory\n      -rlibrary\n      -f                               Don't automatically require files\n      ...\n\nIf you're testing a complex project, make sure you prepare necessary libraries\nand load paths:\n\n  % rdoctest -Ilib -rmylibrary lib/**/*.rb\n\n\nIf your application handles the loading of files, suppress Rdoctest's autoload\nmechanism:\n\n  % rdoctest -f -r./config/environment app/**/*.rb\n\n\n=== Rake\n\nRdoctest comes with a Rake task that you can load in your Rakefile.\n\n  require 'rdoctest/task'\n  Rdoctest::Task.new\n\n\nRunning it is simple.\n\n  % rake doctest\n\n\nIt implements a configuration similar to Rake's TestTask.\n\n  Rdoctest::Task.new :test do |t|\n    t.libs      \u003c\u003c 'lib'          # The 'lib' directory is loaded by default,\n    t.ruby_opts \u003c\u003c '-rrdoctest'   # but require needed files with +ruby_opts+.\n  end\n\n\n=== Rails\n\nI haven't done much testing in Rails yet, but the following should work:\n\nFirst, update your Gemfile to include the gem in your test group.\n\n  group :test do\n    gem 'rdoctest'\n  end\n\n\nRun \u003ctt\u003ebundle install\u003c/tt\u003e, and you can immediately invoke the CLI.\n\n  % rdoctest -f -r./config/environment app/**/*.rb lib/**/*.rb\n\n\n== Roadmap\n\n* Better detection of code blocks (the 2-space indent is too restrictive).\n* Test plain text files (READMEs, for example).\n* Autotest integration?\n* Better Rails support?\n* Test shell snippets (beginning with \u003ctt\u003e$\u003c/tt\u003e and \u003ctt\u003e%\u003c/tt\u003e)?\n\n\n== Prior Art\n\n{rubydoctest}[http://github.com/tablatom/rubydoctest]\n\n\n== License\n\n(The MIT License)\n\n(c) 2010 Stephen Celis \u003cstephen@stephencelis.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Frdoctest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstephencelis%2Frdoctest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstephencelis%2Frdoctest/lists"}