{"id":22981027,"url":"https://github.com/rubyworks/bang","last_synced_at":"2025-09-10T15:36:35.229Z","repository":{"id":62553963,"uuid":"3396383","full_name":"rubyworks/bang","owner":"rubyworks","description":"Bang! Bang! Your dead! (Yet another Assertions Framework)","archived":false,"fork":false,"pushed_at":"2012-12-21T15:35:16.000Z","size":432,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T23:03:16.047Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://rubyworks.github.com/bang","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/rubyworks.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-09T11:00:43.000Z","updated_at":"2013-10-03T17:30:21.000Z","dependencies_parsed_at":"2022-11-03T04:45:41.925Z","dependency_job_id":null,"html_url":"https://github.com/rubyworks/bang","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fbang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fbang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fbang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubyworks%2Fbang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubyworks","download_url":"https://codeload.github.com/rubyworks/bang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246793055,"owners_count":20834921,"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-12-15T01:46:45.845Z","updated_at":"2025-04-02T09:42:07.016Z","avatar_url":"https://github.com/rubyworks.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bang! Bang!\n\n[Website](http://rubyworks.github.com/bang) /\n[Report Issue](http://github.com/rubyworks/bang/issues) /\n[Source Code](http://github.com/rubyworks/bang)\n( [![Build Status](https://secure.travis-ci.org/rubyworks/bang.png)](http://travis-ci.org/rubyworks/bang) )\n\n\u003cbr/\u003e\n\nBang! Bang! is a [BRASS](http://rubyworks.github.com/brass) compliant assertions\nframework with a very clever design that translates any bang call, e.g. `#foo!`\ninto an assertion based on the corresponding query call if it exists, e.g. `#foo?`.\nIn practice the framework is similar to MiniTest's spec methods,\ne.g. `#must_equal`, but the dynamic nature of Bang! Bang! makes it much more \nflexible, as it is not limited to a finite set of assertion methods.\n\nIt's also pretty interesting idea that bang methods would be assertion methods.\nIn general practice bang methods are usually used for methods that change the\nstate of an object *in-place*. But this isn't particularly necessary and \nis just as well handled by non-bang methods, e.g. `#update` vs `#merge!`.\n\n\n## Instructions\n\nUsage is pretty straight forward.\n\n```ruby\n    require 'bang'\n\n    \"This string\".equals!(\"That string\")  #=\u003e raises Bang::Assertion\n```\n\nTo use Bang! Bang! most effectively with common test frameworks, you may need\nto load an adapter to ensure the framework recognizes the assertions as\nsuch rather than as ordinary errors.\n\nFor MiniTest use:\n\n```ruby\n    require 'bang/minitest'`\n```\n\nFor TestUnit use:\n\n```ruby\n    require 'bang/testunit'\n```\n\nAn RSpec adapter is in the works.\n\nCucumber does not require an adapter as it does not differentiate errors\nfrom assertions.\n\nNote, these adapters simply require the `brass/adapters/minitest` and\n`brass/adapters/testunit` respectively along with `bang`. So that's another\nway to do it too.\n\n\n## Considerations\n\nBang! Bang! works via a set of core extensions. There may be some concern\nabout this approach for a test framework. I can assure you that the fear\nof the inaptly named \"monkey patch\" is very much overwrought.\n\nEven though Bang! Bang! adds a `#method_missing` call to the Object class, it is\nalmost always okay to use because it does not get called if an object already has\na bang method defined for it's own use. And when it does get called it only applies\nif a corresponding query (e.g. `foo?`) method exists.\n\nThe other core extensions it adds are simply convenience methods that make testing\neasier. Because these are only additions and not overrides, it is perfectly safe to\nuse in all but the most esoteric cases (such a heavy meta-programming). In fact, if\na program doesn't work because of these core extensions, that's usually a good \nindication that something isn't being done right in the program itself.\n\n\n## Copyrights\n\nBang Bang is copyrighted open source software.\n\n    Copyright (c) 2012 Rubyworks\n\nYou can redistribute it in accordance to the [BSD-2-Clause](http://spdx.org/licenses/BSD-2-Clause) license.\n\nSee the included LICENSE.txt file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fbang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyworks%2Fbang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyworks%2Fbang/lists"}