cucumber - Passing in an existing variable into a Ruby method -


Text after "

I'm sure existing users can not register (using cucumber, Watir-Webdriver and page to write a test

I have the following code:

  text_field (: Email ,: id = & gt; "USER_EMAIL") text_field (: Password: ID = & Gt; "user_password") text_field (: password_confirmation, id = & gt; "user_password_confirmation") checkbox (: terms_privacy ,: id = & gt; "user_accepts_terms") button (: sign_up_button,: text = & gt; Sign up ") def unique_username @ sub User Name = "qa_automation" + "# {Rand (6 ** 6)}" + "@ gmail.com" End Def sign_up unique_username self.email = @ User Name self.password = User ['password'] self.password_confirmation = User ['password'] puts self.check_terms_privacy self.sign_up_button "Username: # {@ User Name}" @existing = @ Username End End signifies sign_up_with_existing_account "Existing user name: # {@ existing}" self. Email = @exisiting self.passwo rd = user ['password'] self.password_confirmation = user ['password'] self.check_terms_privacy puts self.sign_up_button "Username: # {@ existing}"  end 

but the @existing variable is not returning anything these two lines are not giving me anything:

  Username: Username: # {@ Existing} "self.email = @exisiting  

So I think 'sign_up_with_existing_account' method with the 'sign_up' method I am trying to find out how to pass @existing variable in? idea?

You should not do this and should not run a test and affect the outcome of another The test will be a mess mess, you should set the existing user ahead of time (eg using before ) to take advantage of any existing user to take advantage of it.


Comments