{"id":21502405,"url":"https://github.com/fixrb/expresenter","last_synced_at":"2026-02-11T07:04:27.966Z","repository":{"id":56845250,"uuid":"366505483","full_name":"fixrb/expresenter","owner":"fixrb","description":"Expectation result presenter","archived":false,"fork":false,"pushed_at":"2024-12-31T22:26:39.000Z","size":163,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T09:18:01.689Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fixrb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2021-05-11T20:29:54.000Z","updated_at":"2024-12-31T22:26:41.000Z","dependencies_parsed_at":"2024-11-23T18:14:57.646Z","dependency_job_id":"d0d942bf-9823-4de8-a99e-77dd0271beda","html_url":"https://github.com/fixrb/expresenter","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"e6c247a932f17c2c13eeb815745d32a6ca6825d8"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/fixrb/expresenter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fexpresenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fexpresenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fexpresenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fexpresenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fixrb","download_url":"https://codeload.github.com/fixrb/expresenter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fixrb%2Fexpresenter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29329492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-11-23T18:14:50.400Z","updated_at":"2026-02-11T07:04:27.943Z","avatar_url":"https://github.com/fixrb.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Expresenter\n\n[![Version](https://img.shields.io/github/v/tag/fixrb/expresenter?label=Version\u0026logo=github)](https://github.com/fixrb/expresenter/tags)\n[![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/fixrb/expresenter/main)\n[![License](https://img.shields.io/github/license/fixrb/expresenter?label=License\u0026logo=github)](https://github.com/fixrb/expresenter/raw/main/LICENSE.md)\n\n\u003e A Ruby gem for presenting test expectation results with rich formatting and requirement level support. Perfect for test frameworks and assertion libraries that need flexible result reporting with support for MUST/SHOULD/MAY requirement levels.\n\n## Features\n\n- Rich test result presentation with:\n  - Colored output for different result types (success, warning, info, failure, error)\n  - Single-character indicators for compact output (\".\", \"W\", \"I\", \"F\", \"E\")\n  - Emoji support for visual feedback (✅, ⚠️, 💡, ❌, 💥)\n  - ANSI-colored formatted messages with bold titles\n- Support for RFC 2119 requirement levels (MUST/SHOULD/MAY)\n- Comprehensive result classification:\n  - Success: Test passed as expected (green)\n  - Warning: Non-critical issues, typically for SHOULD/MAY requirements (yellow)\n  - Info: Additional information about passing tests (blue)\n  - Failure: Test failed but no exception occurred (purple)\n  - Error: Unexpected exceptions during test execution (red)\n- Built-in support for negative assertions\n- Detailed error reporting with captured exceptions\n- Clean integration with test frameworks via simple API\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"expresenter\"\n```\n\nAnd then execute:\n\n```sh\nbundle install\n```\n\nOr install it yourself as:\n\n```sh\ngem install expresenter\n```\n\n## Usage\n\n### Basic Example\n\n```ruby\n# Create a successful test result\nresult = Expresenter.call(true).new(\n  actual:     \"foo\",\n  definition: 'eq \"foo\"',\n  error:      nil,\n  got:        true,\n  negate:     false,\n  level:      :MUST\n)\n\nresult.passed?    # =\u003e true\nresult.to_sym     # =\u003e :success\nresult.char       # =\u003e \".\"\nresult.emoji      # =\u003e \"✅\"\nresult.to_s       # =\u003e 'Success: expected \"foo\" to eq \"foo\".'\n```\n\n### Handling Different Result Types\n\n```ruby\n# Warning example (non-critical requirement)\nwarning = Expresenter.call(true).new(\n  actual:     \"foo\",\n  definition: \"be_optimized\",\n  error:      nil,\n  got:        false, # triggers warning state\n  negate:     false,\n  level:      :SHOULD\n)\n\nwarning.warning? # =\u003e true\nwarning.char     # =\u003e \"W\"\nwarning.emoji    # =\u003e \"⚠️\"\n\n# Failure example with exception\nbegin\n  Expresenter.call(false).with(\n    actual:     42,\n    definition: \"eq 43\",\n    error:      nil,\n    got:        false,\n    negate:     false,\n    level:      :MUST\n  )\nrescue Expresenter::Fail =\u003e e\n  e.failure? # =\u003e true\n  e.char        # =\u003e \"F\"\n  e.emoji       # =\u003e \"❌\"\n  e.to_s        # =\u003e \"Failure: expected 42 to eq 43.\"\nend\n```\n\n### Using Requirement Levels\n\nExpresenter supports RFC 2119 requirement levels:\n\n- `:MUST` - Critical requirements that must be satisfied\n- `:SHOULD` - Recommended requirements that should be satisfied when possible\n- `:MAY` - Optional requirements that may be satisfied\n\n```ruby\n# SHOULD requirement with warning\nresult = Expresenter.call(true).new(\n  actual:     response,\n  definition: \"have_fast_response_time\",\n  error:      nil,\n  got:        false,\n  negate:     false,\n  level:      :SHOULD\n)\n\nresult.warning? # =\u003e true\n```\n\n### Working with Negative Assertions\n\n```ruby\n# Negative assertion example\nresult = Expresenter.call(true).new(\n  actual:     \"foo\",\n  definition: 'eq \"bar\"',\n  error:      nil,\n  got:        true,\n  negate:     true, # indicates negative assertion\n  level:      :MUST\n)\n\nresult.negate?  # =\u003e true\nresult.to_s     # =\u003e 'Success: expected \"foo\" not to eq \"bar\".'\n```\n\n## Integration\n\nExpresenter can be easily integrated into test frameworks and assertion libraries. It provides a simple API for creating and handling test results with rich formatting and requirement levels.\n\nExample integration with a test framework:\n\n```ruby\ndef assert(actual, matcher, level: :MUST)\n  result = matcher.match(actual)\n\n  Expresenter.call(result.success?).with(\n    actual:     actual,\n    definition: matcher.description,\n    error:      result.error,\n    got:        result.matched?,\n    negate:     false,\n    level:      level\n  )\nend\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/fixrb/expresenter. This project is intended to be a safe, welcoming space for collaboration.\n\n## License\n\nThe [gem](https://rubygems.org/gems/expresenter) is available as open source under the terms of the [MIT License](https://github.com/fixrb/expresenter/raw/main/LICENSE.md).\n\n## Sponsors\n\nThis project is sponsored by [Sashité](https://sashite.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixrb%2Fexpresenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffixrb%2Fexpresenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffixrb%2Fexpresenter/lists"}