See this blog post to understand why you might want to use this tool.
gem install pairwise
Pairwise.combinations will return an array of input combinations.
Here’s an example using pairwise with Rspec:
require 'rubygems' require 'pairwise'
describe “something” do
Pairwise.combinations([1,2], [1,2], [2,3]).each do |(event_id, new_event_id, media_id)|
it “should do something with these input values” do
Create a yaml file with your inputs:
event with image: [Football, Basketball, Soccer] event without image: [Football, Basketball, Soccer] media: [Image, Video, Music]
If you want to force the ordering of your inputs:
- event with image: [Football, Basketball, Soccer] - event without image: [Football, Basketball, Soccer] - media: [Image, Video, Music]
Run pairwise passing the input file
$ pairwise inputs.yml
This will output a table ready to be used in your Cucumber features.
| media | event without image | event with image | | Image | Football | Football | | Image | Basketball | Basketball | | Image | Soccer | Soccer | | Video | Football | Soccer | | Video | Basketball | Football | | Video | Soccer | Basketball | | Music | Football | Basketball | | Music | Basketball | Soccer | | Music | Soccer | Football |