{"id":14991225,"url":"https://github.com/rspec/rspec-its","last_synced_at":"2025-05-14T05:10:41.185Z","repository":{"id":10778980,"uuid":"13045616","full_name":"rspec/rspec-its","owner":"rspec","description":"`its` for RSpec 3 extracted from rspec-core 2.x","archived":false,"fork":false,"pushed_at":"2025-02-16T00:41:21.000Z","size":133,"stargazers_count":271,"open_issues_count":1,"forks_count":37,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-10T12:37:10.424Z","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":"fxbois/web-mode","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rspec.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"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},"funding":{"github":["JonRowe"],"open_collective":"rspec"}},"created_at":"2013-09-23T19:57:22.000Z","updated_at":"2025-05-04T19:11:37.000Z","dependencies_parsed_at":"2023-01-13T16:09:04.097Z","dependency_job_id":"8b723f98-a3e4-4f19-afc8-8606f41d1219","html_url":"https://github.com/rspec/rspec-its","commit_stats":{"total_commits":137,"total_committers":20,"mean_commits":6.85,"dds":0.5620437956204379,"last_synced_commit":"9b1fee340da374a0547228324a38085bdaa2022a"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-its","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-its/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-its/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rspec%2Frspec-its/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rspec","download_url":"https://codeload.github.com/rspec/rspec-its/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253568691,"owners_count":21928909,"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-09-24T14:21:54.678Z","updated_at":"2025-05-14T05:10:41.147Z","avatar_url":"https://github.com/rspec.png","language":"Ruby","funding_links":["https://github.com/sponsors/JonRowe","https://opencollective.com/rspec"],"categories":[],"sub_categories":[],"readme":"# RSpec::Its [![Build Status](https://github.com/rspec/rspec-its/actions/workflows/ci.yml/badge.svg)](https://github.com/rspec/rspec-its/actions/workflows/ci.yml/badge.svg)\n\nRSpec::Its provides the `its` method as a short-hand to specify the expected value of an attribute.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rspec-its'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rspec-its\n\nAnd require it as:\n\n```ruby\nrequire 'rspec/its'\n```\n\n## Usage\n\nUse the `its` method to generate a nested example group with a single example that specifies the expected value\nof an attribute of the subject using `is_expected`. The `its` method can also specify the block expectations of\nan attribute of the subject using `will` or `will_not`.\n\n`its` accepts a symbol or a string, and a block representing the example.\n\n```ruby\nits(:size)    { is_expected.to eq(1) }\nits(\"length\") { is_expected.to eq(1) }\n```\n\nYou can use a string with dots to specify a nested attribute (i.e. an\nattribute of the attribute of the subject).\n\n```ruby\nits(\"phone_numbers.size\") { is_expected.to_not eq(0) }\n```\n\nThe following should-style method is also available:\n\n```ruby\nits(:size) { should eq(1) }\n```\n\nas is an alias of `is_expected` for pluralized use:\n\n```ruby\nits(:keys) { are_expected.to eq([:key1, :key2]) }\n```\n\nThe following block expect-style method is also available:\n\n```ruby\nits(:size) { will_not raise_error }\n```\n\nas is this alias for pluralized use:\n\n```ruby\nits(:keys) { will raise_error(NoMethodError) }\n```\n\nWhen the subject implements the `[]` operator, you can pass in an array with a single key to\nrefer to the value returned by that operator when passed that key as an argument.\n\n```ruby\nits([:key]) { is_expected.to eq(value) }\n```\n\nFor hashes, multiple keys within the array will result in successive accesses into the hash. For example:\n\n```ruby\nsubject { {key1: {key2: 3} } }\nits([:key1, :key2]) { is_expected.to eq(3) }\n```\n\nFor other objects, multiple keys within the array will be passed as separate arguments in a single method call to [], as in:\n\n```ruby\nsubject { Matrix[ [:a, :b], [:c, :d] ] }\nits([1,1]) { is_expected.to eq(:d) }\n```\n\nMetadata arguments are supported.\n\n```ruby\nits(:size, focus: true) { is_expected.to eq(1) }\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspec%2Frspec-its","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frspec%2Frspec-its","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frspec%2Frspec-its/lists"}