Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Space between two variable values ​in Ruby

I have two fields that were stored with values ​​through a faker gem. First Name and Last name fields. I took the value of these fields and stored it in two variables. I want to compare the name of this user in the logged area.
The first name and lastname in the logged area appears with space but in my validation when I concatenate these two values ​​I am not able to insert the space to validate against the logged area

############### my code ##############
@take_first_name = input_first_name.send_keys(Faker::Name.first_name).value
input_last_name.send_keys(Faker::Name.last_name)
@take_last_name = input_last_name.send_keys(Faker::Name.last_name).value

def logged_area
  
  fname_lname = @take_first_name + @take_last_name
  pp fname_lname
  take_user = view_user.text (logged area)
  expect(take_user).to eql (fname_lname)
 end

error:
   Reason:

      expected: "RustyDevonKubKoss"
           got: "RustyDevon KubKoss"

      (compared using eql?)

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you mean the part with
@take_first_name + @take_last_name

you maybe can use it as string
"#{@take_first_name} #{@take_last_name}"

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading