Home > Software engineering >  Space between two variable values ​in Ruby
Space between two variable values ​in Ruby

Time:11-29

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?)

CodePudding user response:

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}"

  •  Tags:  
  • ruby
  • Related