How can I write the function in cucumber with watir-webdriver? I mean, I have same code and I don’t want always to re-write it. I just want to write this function and then use it. This will help me to make my code shorter.
For example, this function:
def login
@b.text_field(:id => `login`).set `login`
@b.text_field(:id => `passw`).set `passw`
@b.button(:id => `submit`).click
end
…and then I want to use it this way:
get :login
…but I don’t know how to write it correctly.
1 Answer