Module: Calabash::Cucumber::QueryHelpers

Included in:
Core
Defined in:
lib/calabash-cucumber/query_helpers.rb

Overview

A module of methods that can help you construct queries.

Instance Method Summary collapse

Instance Method Details

#escape_quotes(str) ⇒ String

call this method to properly escape single quotes in Calabash queries Calabash iOS has some annoying rules for text containing single quotes. This helper frees you from manual escaping.

Examples:

quoted = escape_quotes("Karl's child")
# => "Karl\\'s child"

Parameters:

  • str (String)

    string to escape

Returns:

  • (String)

    escaped version of ‘str`



15
16
17
# File 'lib/calabash-cucumber/query_helpers.rb', line 15

def escape_quotes(str)
  str.gsub("'", "\\\\'")
end