mardi 6 novembre 2018

Call by name parametrized tests in rails

In rails project I have the following test:

[1,2,3,4,5].each do |i|
  test "mypow2 #{i}" do
    assert mypow2(i) == i*i
  end
end

if the test is not parametrized I can run it by:

rails test path/to/test --name=test_mypow2

so that I can run this single test.

Now that my test is parametrized, is there a way to run only those 5 tests, without knowing the values of the parameters.

Maybe something like:

rails test path/to/test --name=test_mypow2*

Note that this example is very simplified, my test data is quite complicated, and it is extremely inconvenient to put the values of the parameters in the test name, even though I know them.

Aucun commentaire:

Enregistrer un commentaire