{"id":13994826,"url":"https://github.com/leahneukirchen/bacon","last_synced_at":"2025-04-06T04:10:56.126Z","repository":{"id":54370930,"uuid":"59494","full_name":"leahneukirchen/bacon","owner":"leahneukirchen","description":"a small RSpec clone","archived":false,"fork":false,"pushed_at":"2022-10-18T15:39:56.000Z","size":85,"stargazers_count":424,"open_issues_count":8,"forks_count":72,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-05-01T23:22:37.276Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rubyforge.org/projects/test-spec/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leahneukirchen.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2008-10-04T11:34:43.000Z","updated_at":"2024-04-30T00:31:54.000Z","dependencies_parsed_at":"2022-08-13T13:40:35.496Z","dependency_job_id":null,"html_url":"https://github.com/leahneukirchen/bacon","commit_stats":null,"previous_names":["chneukirchen/bacon"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leahneukirchen%2Fbacon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leahneukirchen%2Fbacon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leahneukirchen%2Fbacon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leahneukirchen%2Fbacon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leahneukirchen","download_url":"https://codeload.github.com/leahneukirchen/bacon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430870,"owners_count":20937874,"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-08-09T14:03:07.593Z","updated_at":"2025-04-06T04:10:56.108Z","avatar_url":"https://github.com/leahneukirchen.png","language":"Ruby","funding_links":[],"categories":["Ruby","Testing"],"sub_categories":[],"readme":"= Bacon -- small RSpec clone.\n\n   \"Truth will sooner come out from error than from confusion.\"\n                                               ---Francis Bacon\n\nBacon is a small RSpec clone weighing less than 350 LoC but\nnevertheless providing all essential features.\n\n\n== Whirl-wind tour\n\n    require 'bacon'\n    \n    describe 'A new array' do\n      before do\n        @ary = Array.new\n      end\n      \n      it 'should be empty' do\n        @ary.should.be.empty\n        @ary.should.not.include 1\n      end\n    \n      it 'should have zero size' do\n        @ary.size.should.equal 0\n        @ary.size.should.be.close 0.1, 0.5\n      end\n    \n      it 'should raise on trying fetch any index' do\n        lambda { @ary.fetch 0 }.\n          should.raise(IndexError).\n          message.should.match(/out of array/)\n    \n        # Alternatively:\n        should.raise(IndexError) { @ary.fetch 0 }\n      end\n    \n      it 'should have an object identity' do\n        @ary.should.not.be.same_as Array.new\n      end\n    \n      # Custom assertions are trivial to do, they are lambdas returning a\n      # boolean vale:\n      palindrome = lambda { |obj| obj == obj.reverse }\n      it 'should be a palindrome' do\n        @ary.should.be.a palindrome\n      end\n    \n      it 'should have super powers' do\n        should.flunk \"no super powers found\"\n      end\n    end\n\nNow run it:\n\n    $ bacon whirlwind.rb\n    A new array\n    - should be empty\n    - should have zero size\n    - should raise on trying fetch any index\n    - should have an object identity\n    - should be a palindrome\n    - should have super powers [FAILED]\n    \n    Bacon::Error: no super powers found\n    \t./whirlwind.rb:39: A new array - should have super powers\n    \t./whirlwind.rb:38\n    \t./whirlwind.rb:3\n    \n    6 specifications (9 requirements), 1 failures, 0 errors\n\nIf you want shorter output, use the Test::Unit format:\n\n    $ bacon -q whirlwind.rb\n    .....F\n    Bacon::Error: no super powers found\n    \t./whirlwind.rb:39: A new array - should have super powers\n    \t./whirlwind.rb:38\n    \t./whirlwind.rb:3\n    \n    6 tests, 9 assertions, 1 failures, 0 errors\n\nIt also supports TAP:\n\n    $ bacon -p whirlwind.rb\n    ok 1        - should be empty\n    ok 2        - should have zero size\n    ok 3        - should raise on trying fetch any index\n    ok 4        - should have an object identity\n    ok 5        - should be a palindrome\n    not ok 6    - should have super powers: FAILED\n    # Bacon::Error: no super powers found\n    # \t./whirlwind.rb:39: A new array - should have super powers\n    # \t./whirlwind.rb:38\n    # \t./whirlwind.rb:3\n    1..6\n    # 6 tests, 9 assertions, 1 failures, 0 errors\n\n    $ bacon -p whirlwind.rb | taptap -q\n    Tests took 0.00 seconds.\n    FAILED tests 6\n       6) should have super powers: FAILED\n\n    Failed 1/6 tests, 83.33% okay.\n\n(taptap is available from http://chneukirchen.org/repos/taptap/)\n\nAs of Bacon 1.1, it also supports Knock:\n\n    $ bacon -k whirlwind.rb\n    ok - should be empty\n    ok - should have zero size\n    ok - should raise on trying fetch any index\n    ok - should have an object identity\n    ok - should be a palindrome\n    not ok - should have super powers: FAILED\n    # Bacon::Error: no super powers found\n    # \t./whirlwind.rb:39: A new array - should have super powers\n    # \t./whirlwind.rb:38\n    # \t./whirlwind.rb:3\n\n    $ bacon -k whirlwind.rb | kn-sum\n    6 tests, 1 failed (83.3333% succeeded)\n\n(knock is available from http://github.com/chneukirchen/knock/)\n\n\n== Implemented assertions\n\n* should.\u003cpredicate\u003e and should.be.\u003cpredicate\u003e\n* should.equal\n* should.match\n* should.be.identical_to / should.be.same_as\n* should.raise(*exceptions) { }\n* should.change { }\n* should.throw(symbol) { }\n* should.satisfy { |object| }\n\n\n== Added core predicates\n\n* Object#true?\n* Object#false?\n* Proc#change?\n* Proc#raise?\n* Proc#throw?\n* Numeric#close?\n\n\n== before/after\n\nbefore and after need to be defined before the first specification in\na context and are run before and after each specification.\n\nAs of Bacon 1.1, before and after do nest in nested contexts.\n\n\n== Shared contexts\n\nYou can define shared contexts in Bacon like this:\n\n    shared \"an empty container\" do\n      it \"should have size zero\" do\n      end\n\n      it \"should be empty\" do\n      end\n    end\n\n    context \"A new array\" do\n      behaves_like \"an empty container\"\n    end\n\nThese contexts are not executed on their own, but can be included with\nbehaves_like in other contexts.  You can use shared contexts to\nstructure suites with many recurring specifications.\n\n\n== Matchers\n\nCustom matchers are simply lambdas returning a boolean value, for\nexample:\n\n  def shorter_than(max_size)\n    lambda { |obj| obj.size \u003c max_size }\n  end\n\n  [1,2,3].should.be shorter_than(5)\n\nYou can use modules and extend to group matchers for use in multiple\ncontexts.\n\n\n== bacon standalone runner\n\n  -s, --specdox            do AgileDox-like output (default)\n  -q, --quiet              do Test::Unit-like non-verbose output\n  -p, --tap                do TAP (Test Anything Protocol) output\n  -k, --knock              do Knock output\n  -o, --output FORMAT      do FORMAT (SpecDox/TestUnit/Tap) output\n  -Q, --no-backtrace       don't print backtraces  \n  -a, --automatic          gather tests from ./test/, include ./lib/\n  -n, --name NAME          runs tests matching regexp NAME\n  -t, --testcase TESTCASE  runs tests in TestCases matching regexp TESTCASE\n\nIf you don't want to use the standalone runner, run\nBacon.summary_on_exit to install an exit handler showing the summary.\n\n\n== Object#should\n\nYou can use Object#should outside of contexts, where the result of\nassertion will be returned as a boolean.  This is nice for\ndemonstrations, quick checks and doctest tests.\n\n    \u003e\u003e require 'bacon'\n    \u003e\u003e (1 + 1).should.equal 2\n    =\u003e true\n    \u003e\u003e (6*9).should.equal 42\n    =\u003e false\n\n\n== Bacon with autotest\n\nSince version 1.0, there is autotest support.  You need to tag your\ntest directories (test/ or spec/) by creating an .bacon file there.\nAutotest then will find it.  bin/bacon needs to be in PATH or RUBYPATH.\n\n\n== Converting specs\n\nspec-converter is a simple tool to convert test-unit or dust style\ntests to test/spec specs.\n\nIt can be found at https://github.com/relevance/spec_converter.\n\n\n== Thanks to\n\n* Michael Fellinger, for fixing Bacon for 1.9 and various improvements.\n* Gabriele Renzi, for implementing Context#should.\n* James Tucker, for the autotest support.\n* Yossef Mendelssohn, for nested contexts.\n* everyone contributing bug fixes.\n\n\n== History\n\n* January 7, 2008: First public release 0.9.\n\n* July 6th, 2008: Second public release 1.0.\n  * Add Context#should as a shortcut for Context#it('should ' + _).\n  * describe now supports multiple arguments for better organization.\n  * Empty specifications are now erroneous.\n  * after-blocks run in the case of exceptions too.\n  * Autotest support.\n  * Bug fixes.\n\n* November 30th, 2008: Third public release 1.1.\n  * Nested before/after.\n  * Add -Q/--no-backtraces to not show details about failed specifications.\n  * Add Knock output.\n  * Bug fixes.\n\n* December 21th, 2012: Fourth public release 1.2.0.\n  * #satisfy will not pass arguments anymore to the block, use lexical scope.\n  * Fixed Context#change?.\n  * Add support for finding specs named like spec/**/*_spec.rb.\n  * Contexts nest properly.\n  * Timer in TestUnitOutput.\n  * Nested output for SpecDoxOutput.\n  * Small cleanups and more tests.\n\n\n== Contact\n\nPlease mail bugs, suggestions and patches to\n\u003cmailto:chneukirchen@gmail.com\u003e.\n\nGit repository (patches rebased on HEAD are most welcome):\nhttp://github.com/chneukirchen/bacon\ngit://github.com/chneukirchen/bacon.git\n\n\n== Copying\n\nCopyright (C) 2007, 2008, 2012 Christian Neukirchen \u003cpurl.org/net/chneukirchen\u003e\n\nBacon is freely distributable under the terms of an MIT-style license.\nSee COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n\n== Links\n\nBehavior-Driven Development:: \u003chttp://behaviour-driven.org/\u003e\nRSpec:: \u003chttp://rspec.rubyforge.org/\u003e\ntest/spec:: \u003chttp://test-spec.rubyforge.org/\u003e\n\nChristian Neukirchen:: \u003chttp://chneukirchen.org/\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleahneukirchen%2Fbacon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleahneukirchen%2Fbacon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleahneukirchen%2Fbacon/lists"}