{"id":15240491,"url":"https://github.com/smartcasual/rspec-permutations","last_synced_at":"2026-02-11T01:03:35.625Z","repository":{"id":63845179,"uuid":"321750418","full_name":"SmartCasual/rspec-permutations","owner":"SmartCasual","description":"RSpec::Permutations is a gem that provides a simple way to run your RSpec tests with different permutations of parameters.  This makes combinatorial unit testing faster to write and easier to read.","archived":false,"fork":false,"pushed_at":"2022-11-27T10:55:57.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T11:41:30.454Z","etag":null,"topics":["rspec","ruby"],"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/SmartCasual.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2020-12-15T18:10:39.000Z","updated_at":"2022-11-27T11:02:07.000Z","dependencies_parsed_at":"2022-11-27T11:31:08.449Z","dependency_job_id":null,"html_url":"https://github.com/SmartCasual/rspec-permutations","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartCasual%2Frspec-permutations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartCasual%2Frspec-permutations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartCasual%2Frspec-permutations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SmartCasual%2Frspec-permutations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SmartCasual","download_url":"https://codeload.github.com/SmartCasual/rspec-permutations/tar.gz/refs/heads/main","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":["rspec","ruby"],"created_at":"2024-09-29T11:05:16.684Z","updated_at":"2026-02-11T01:03:35.597Z","avatar_url":"https://github.com/SmartCasual.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rspec::Permutations 1.0.0\n\n[![SmartCasual](https://circleci.com/gh/SmartCasual/rspec-permutations.svg?style=svg)](https://app.circleci.com/pipelines/github/SmartCasual/rspec-permutations)\n\nRSpec::Permutations is a gem that provides a simple way to run your RSpec tests with different permutations of parameters.\n\nThis makes combinatorial unit testing faster to write and easier to read.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem \"rspec-permutations\"\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install rspec-permutations\n\n## Usage\n\nDefine a permutation group in your spec file, then use the `permutations` method to run your tests once for each permutation:\n\n```ruby\n=begin\n| a     | b     | result   |\n| 1     | 2     | 3        |\n| 2.0   | 3     | 5.0      |\n| \"car\" | \"pet\" | \"carpet\" |\n=end\n\nRSpec.describe \"An example with the + method\" do\n  permutations do\n    it \"combines `a` and `b`\" do\n      expect(a + b).to eq(result)\n    end\n  end\nend\n```\n\nThis would be the equivalent to writing:\n\n```ruby\nRSpec.describe \"An example with the + method\" do\n  context \"with permutation a: 1, b: 2, result: 3\" do\n    let(:a) { 1 }\n    let(:b) { 2 }\n    let(:result) { 3 }\n\n    it \"combines `a` and `b`\" do\n      expect(a + b).to eq(result)\n    end\n  end\n\n  context \"with permutation a: 2.0, b: 3, result: 5.0\" do\n    let(:a) { 2.0 }\n    let(:b) { 3 }\n    let(:result) { 5.0 }\n\n    it \"combines `a` and `b`\" do\n      expect(a + b).to eq(result)\n    end\n  end\n\n  context \"with permutation a: 'car', b: 'pet', result: 'carpet'\" do\n    let(:a) { \"car\" }\n    let(:b) { \"pet\" }\n    let(:result) { \"carpet\" }\n\n    it \"combines `a` and `b`\" do\n      expect(a + b).to eq(result)\n    end\n  end\nend\n```\n\n### Multiple permutation blocks\n\nYou can define multiple permutation blocks in a single spec file, then use the `permutations` method to run your tests once for each permutation, giving the permutation block's name:\n\n```ruby\n=begin First permutation group\n| a | b | c        |\n| 1 | 2 | \"apple\"  |\n| 2 | 3 | \"banana\" |\n=end\n\n=begin Second permutation group\n| d | e            |\n| 5 | {a: 1, b: 2} |\n| 2 | 3            |\n=end\n\nRSpec.describe SomeClass do\n  permutations \"First permutation group\" do\n    it \"does something\" do\n      # a, b, and c are available here\n    end\n  end\n\n  permutations \"Second permutation group\" do\n    it \"does something else\" do\n      # d and e are available here\n    end\n  end\nend\n```\n\nYour blocks can be named however you like.\n\nSee `spec/rspec/permutations_spec.rb` for more examples.\n\n### Rubocop\n\nRubocop will complain about the `=begin` and `=end` comments. You may want to disable it for spec files:\n\n```yaml\n# .rubocop.yml\nStyle/BlockComments:\n  Exclude:\n    - spec/**/*\n```\n\n## Development\n\nThe instructions in this section were added when the gem was generated, please let me know if any of them are incorrect.\n\nAfter checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/SmartCasual/rspec-permutations/pulls.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcasual%2Frspec-permutations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcasual%2Frspec-permutations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcasual%2Frspec-permutations/lists"}