This is a simple question. I have Cucumber steps, for example:
Given /We have the test environment/ do @user =
At the next stage, I use my own classes, they simplify the testing process:
Then /all should be fine/ do
Inside the MyValidatorClass instance, I look at the above instance variables @user, @post, etc.
What is the best and easiest way to access Cucumber variables from an instance of MyValidatorClass?
class MyValidatorClass def valid? @post @user end end
Now I manually passed all the arguments to the MyValidatorClass instance:
validator = MyValidatorClass.new @user, @post
But I think this goal is bad. I need something more transparent, because we use Ruby, therefore!
What is the best way to do this?
source share