The idea being that for some scenarios we do not all the variables to be used. (e.g., a method which has several guard clauses which each check one or more inputs).
Given a method like this:
def method_under_set(input1, input2, input3)
return unless is_valid(input1)
return unless is_valid(input2)
return unless is_valid(input3)
input1 + input2 + input3
end
I might have a tabular spec like this:
inputs :input1, :input2, :input3
it_with :value1, nil, nil, nil
it_with :value1, :value2, nil, nil
it_with :value1, :value2, :value3, :result
But this does not clearly communicate that the inputs should not actually be used in the first 2 examples. It makes it hard to see which examples expect an actual nil.
So I would like to have:
inputs :input1, :input2, :input3
it_with :value1, :no_op, :no_op, nil
it_with :value1, :value2, :no_op, nil
it_with :value1, :value2, :value3, :result
The variable with the :no_op value could make use of the memoizing/let blocks in order to raise an assertion if the variable is called during the scenario. But that might be unnecessarily complex.
The idea being that for some scenarios we do not all the variables to be used. (e.g., a method which has several guard clauses which each check one or more inputs).
Given a method like this:
I might have a tabular spec like this:
But this does not clearly communicate that the inputs should not actually be used in the first 2 examples. It makes it hard to see which examples expect an actual nil.
So I would like to have:
The variable with the :no_op value could make use of the memoizing/let blocks in order to raise an assertion if the variable is called during the scenario. But that might be unnecessarily complex.