Created
July 15, 2019 08:14
-
-
Save shinnn/c3a0d4e97f21881daa6864ebb6a2b9f6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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