tomykaira / rspec-parameterized

RSpec::Parameterized supports simple parameterized test syntax in rspec.
MIT License
417 stars 28 forks source link

Add support to skip tests #60

Open caalberts opened 4 years ago

caalberts commented 4 years ago

rspec allows us to use xit to temporarily skip tests. It would be great if rspec-parameterized can also support similar functionality.

This would be useful especially when following test driven development with a list of scenarios to be covered. While working on specific scenarios, we could temporarily skip the others and reduce the noise from the test output.

sue445 commented 4 years ago

I think this is good idea. But I can't come up with a good writing style for this.

Do you have any idea where to insert code for skipping tests?

# Nested Array Style
describe "plus" do
  where(:a, :b, :answer) do
    [
      [1 , 2 , 3],
      [5 , 8 , 13],
      [0 , 0 , 0]
    ]
  end
describe "Hash arguments" do
  where(a: [1, 3], b: [5, 7, 9], c: [2, 4])
describe "plus" do
  using RSpec::Parameterized::TableSyntax

  where(:a, :b, :answer) do
    1 | 2 | 3
    5 | 8 | 13
    0 | 0 | 0
  end
describe "Verbose syntax" do
  where do
    {
      "positive integers" => {
        a: 1,
        b: 2,
        answer: 3,
      },
      "negative_integers" => {
        a: -1,
        b: -2,
        answer: -3,
      },
      "mixed_integers" => {
        a: 3,
        b: -3,
        answer: 0,
      },
    }
  end
describe "Custom names for regular syntax" do
  where(:case_name, :a, :b, :answer) do
    [
      ["positive integers",  6,  2,  8],
      ["negative integers", -1, -2, -3],
      [   "mixed integers", -5,  3, -2],
    ]
  end
describe "Custom naming for hash syntax" do
  where(case_names: ->(a, b, c){"#{a} + #{b} + #{c}"}, a: [1, 3], b: [5, 7, 9], c: [2, 4])