{"id":15240476,"url":"https://github.com/znrm/speq","last_synced_at":"2026-01-03T07:06:42.075Z","repository":{"id":56896592,"uuid":"152851930","full_name":"znrm/speq","owner":"znrm","description":"Write simple tests with fewer words \u0026 intuitive execution.","archived":false,"fork":false,"pushed_at":"2021-03-13T08:15:05.000Z","size":62,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-26T09:47:31.848Z","etag":null,"topics":["gem","minitest","rspec","ruby","tdd"],"latest_commit_sha":null,"homepage":"","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/znrm.png","metadata":{"files":{"readme":"README.md","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":"2018-10-13T08:34:51.000Z","updated_at":"2021-03-29T13:15:38.000Z","dependencies_parsed_at":"2022-08-21T01:50:44.005Z","dependency_job_id":null,"html_url":"https://github.com/znrm/speq","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znrm%2Fspeq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znrm%2Fspeq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znrm%2Fspeq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/znrm%2Fspeq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/znrm","download_url":"https://codeload.github.com/znrm/speq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814893,"owners_count":20352038,"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":["gem","minitest","rspec","ruby","tdd"],"created_at":"2024-09-29T11:05:09.726Z","updated_at":"2026-01-03T07:06:42.048Z","avatar_url":"https://github.com/znrm.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Speq\n\n**Ready to use! Issue reports are welcome!**\n\n## Build specs with fewer words\n\nSpeq is a testing library for rapid prototyping in Ruby.\n\nSpeq favors simplicity and minimalism.\n\n```ruby\nis([]).empty?\n#  ✔ [] is empty.\n```\n\nSpeq is ideal whenever it would feel excessive to use one of the existing frameworks, but it's not enough to just print \u0026 inspect outputs.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'speq'\n```\n\nAnd then execute:\n\n```sh\nbundle\n```\n\nOr install it yourself as:\n\n```sh\ngem install speq\n```\n\n## Design \u0026 Syntax\n\nSpeq's design choices are guided by the competing motivations of having tests be as short and simple as possible while maintaining the flexibility to be as descriptive as needed. In contrast to similar tools, speqs are typically framed as _questions_ about a program's behavior rather than assertions about the desired behavior.\n\nDescriptions for simple unit tests are often closely tied to the source code, and as such, Speq tries to eliminate them wherever possible. By breaking down an expression's method/message, arguments, and receiver, Speq can use the additional information to help generate an often sufficiently detailed description of the test.\n\n- receiver: `on(object [, description])`\n- message: `does(symbol [, description])`\n- arguments: `with(*args , \u0026block)` or `of(*args, \u0026block)`\n- question: `*?(*args, \u0026block)`\n\nNote that Speq executes expressions immediately, avoiding the unintuitive execution order of most testing libraries.\n\n```ruby\nspeq('Example test') do\n  on((1..4).to_a.shuffle, 'a shuffled array').does(:sort).eq?([1, 2, 3, 4])\n\n  does(:reverse) do\n    on('3 2 1').eq?('1 2 3')\n    on([3, 2, 1]).eq?([1, 2, 3])\n  end\n\n  with(\u0026-\u003e(idx) { idx * idx }).does(:map).on(0..3).eq?([0, 1, 4, 9])\n\n  is(:rand).a?(Float) # symbol -\u003e does\n  is([]).empty? # not symbol -\u003e on\nend\n```\n\n```\n✔ Example test\n  ✔ sort on a shuffled array equals [1, 2, 3, 4].\n  ✔ reverse...\n    ✔ \"3 2 1\" equals \"1 2 3\".\n    ✔ [3, 2, 1] equals [1, 2, 3].\n  ✔ map(\u0026{ ... }) on 0..3 equals [0, 1, 4, 9].\n  ✔ rand is a Float.\n  ✔ [] is empty.\npass: 5, fail: 0, errors: 0\n```\n\n## Usage\n\n### CLI: Speq Files\n\nSpeq offers a simple CLI that lets you run tests written in dedicated spec files. This is the preferred way to run speq consistent with the examples shown above.\n\nExecuting `speq` (or `bundle exec speq` if using bundle) will recursively search the working directory and run all files that end with `_speq.rb`.\n\nTo run individual files, specify a list of speq file prefixes. For example, to run tests that are within the files `example_speq.rb` and `sample_speq.rb`, simply execute:\n\n    speq example sample\n\nNote that you don't need to require 'speq' within a speq file if running from the CLI.\n\n### Anywhere: Speq.test\n\nSpeq can be used anywhere as long as it is required and all tests are written within a block passed to Speq.test.\n\n```ruby\nrequire 'speq'\n\nspeq(\"testing anywhere\") do\n  ...\nend\n# '.score': returns the proportion of tests passed as a Rational number\n# '.pass?': returns true or false for whether all the tests passed\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on [Speq's GitHub](https://github.com/znrm/speq).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznrm%2Fspeq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fznrm%2Fspeq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fznrm%2Fspeq/lists"}