Search code examples
rubycucumbercalabashcalabash-ioscalabash-android

Is there a way to parameterize Calabash touch or query


Does anyone know if there is a way to uses variables in a calabash touch/query/etc function?

For example, say I have a variable called hotel_name and I wanted to touch("* marked:#{hotel_name}") and use that in a test step like:

Given(/I select "(.*?)"$/) |hotel_name|

touch("* marked:#{hotel_name}") end

it is not working for me. So can someone tell me if this can be done and how?

Thanks


Solution

  • There are missing apostrophes in your query and do in your block :) Proper code should look like that:

    Given(/^I select "(.*?)"$/) do |hotel_name|
      touch("* marked:'#{hotel_name}'")
    end
    

    I think it should help :)