{"id":13778172,"url":"https://github.com/mcorp/shoulda-hanami","last_synced_at":"2025-05-11T11:35:05.886Z","repository":{"id":56895425,"uuid":"51202910","full_name":"mcorp/shoulda-hanami","owner":"mcorp","description":"Making tests easy on the fingers and eyes, but on hanami (old shoulda-lotus)","archived":true,"fork":false,"pushed_at":"2016-07-29T00:10:22.000Z","size":33,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T15:17:51.268Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/mcorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-02-06T13:11:34.000Z","updated_at":"2023-01-28T00:43:42.000Z","dependencies_parsed_at":"2022-08-21T01:20:33.813Z","dependency_job_id":null,"html_url":"https://github.com/mcorp/shoulda-hanami","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcorp%2Fshoulda-hanami","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcorp%2Fshoulda-hanami/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcorp%2Fshoulda-hanami/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcorp%2Fshoulda-hanami/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcorp","download_url":"https://codeload.github.com/mcorp/shoulda-hanami/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253559966,"owners_count":21927706,"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-03T18:00:51.788Z","updated_at":"2025-05-11T11:35:05.611Z","avatar_url":"https://github.com/mcorp.png","language":"Ruby","readme":"# shoulda-hanami\n[![Gem Version](https://badge.fury.io/rb/shoulda-hanami.svg)](http://badge.fury.io/rb/shoulda-hanami) [![Build Status](https://travis-ci.org/mcorp/shoulda-hanami.svg?branch=master)](https://travis-ci.org/mcorp/shoulda-hanami) [![Code Climate](https://codeclimate.com/github/mcorp/shoulda-hanami/badges/gpa.svg)](https://codeclimate.com/github/mcorp/shoulda-hanami) [![Test Coverage](https://codeclimate.com/github/mcorp/shoulda-hanami/badges/coverage.svg)](https://codeclimate.com/github/mcorp/shoulda-hanami/coverage) [![Dependency Status](https://gemnasium.com/mcorp/shoulda-hanami.svg)](https://gemnasium.com/mcorp/shoulda-hanami) [![Inline docs](http://inch-ci.org/github/mcorp/shoulda-hanami.svg?branch=master)](http://inch-ci.org/github/mcorp/shoulda-hanami)\n\nMaking tests easy on the fingers and eyes, but on hanami.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'shoulda-hanami'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install shoulda-hanami\n\n## Configure\n\nCreate file `spec/support/shoulda_hanami.rb` with:\n\n```ruby\nRSpec.configure do |config|\n  config.include Shoulda::Hanami::Matchers\nend\n\n```\n\n## Usage\n\n### Entity\n\n```ruby\nclass Person\n  include Hanami::Validations\n\n  validations do\n    required(:email)    { format?(/@/) }\n    required(:name)     { size?(5..50) }\n    required(:password) { size?(10) }\n    required(:state)    { included_in?(%w(PR SC SP)) }\n    required(:year)     { included_in?(1979..1990) }\n  end\nend\n```\n\n### Spec\n\n```ruby\n# allow_value\nit { is_expected.to allow_value(\"leo@nospam.org\").for(:email) }\nit { is_expected.to_not allow_value('leo-at-nospam.org').for(:email) }\n\n# presence\nit { is_expected.to validate_presence_of(:email) }\n\n# size\nit { is_expected.to validate_length_of(:name).is_at_least(5).is_at_most(50) }\nit { is_expected.to validate_length_of(:password).is_equal_to(10) }\n\n# inclusion\nit { is_expected.to validate_inclusion_of(:state).in_array(%w(PR SC SP)) }\nit { is_expected.to validate_inclusion_of(:year).in_array(1979..1990) }\n```\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","funding_links":[],"categories":["Hanami Gem List"],"sub_categories":["Testing"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcorp%2Fshoulda-hanami","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcorp%2Fshoulda-hanami","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcorp%2Fshoulda-hanami/lists"}