Skip to content

One more way to define examples: the matrixΒ #91

@pyromaniac

Description

@pyromaniac

Hello. First of all, thanks for the great gem!

What do you think of one more way to define the matrix?

where(a: [1,2,3], b: [4,5,6]) do
  [
    [5, 6, 7], # 1+4, 2+4, 3+4
    [6, 7, 8], # 1+5, 2+5, 3+5
    [7, 8, 9]  # 1+6, 2+6, 3+6
  ]
end

with_them do
  specify { expect(a+b).to eq(result) } # the block value is implicitly called `result`
end

Essentially, a way to define just combinations and then all the possible results for all the combinations.
I believe it would be useful in a lot of cases.

If you like it, I can try implementing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions