Skip to content

Instantly share code, notes, and snippets.

@shinnn
Created July 15, 2019 08:14
Show Gist options
  • Save shinnn/c3a0d4e97f21881daa6864ebb6a2b9f6 to your computer and use it in GitHub Desktop.
Save shinnn/c3a0d4e97f21881daa6864ebb6a2b9f6 to your computer and use it in GitHub Desktop.
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| {text: /^#{Regexp.quote(text)}$/}}.each.with_index(1) do |opt, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", opt.merge!(count: 1)
end
end
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| {text: /^#{text}$/, count: 1}}.each.with_index(1) do |opts, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", opts
end
end
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| /^#{Regexp.quote(text)}$/}.each.with_index(1) do |regex, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", text: regex, count: 1
end
end
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| /^#{Regexp.escape(text)}$/}.each.with_index(1) do |regex, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", text: regex, count: 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment