Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow :no_op to be specified as an input value #4

Open
acant opened this issue Dec 8, 2015 · 0 comments
Open

Allow :no_op to be specified as an input value #4

acant opened this issue Dec 8, 2015 · 0 comments

Comments

@acant
Copy link
Contributor

acant commented Dec 8, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant