mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-19 04:49:15 +00:00
Use all_options_absent method instead of poorly written no_options_present
SAVES 30 SECONDS FOR EVERY SPEC THAT IS IT USED IN!
This commit is contained in:
committed by
luisramos0
parent
3e90f9aa1d
commit
c2432fab0b
@@ -21,7 +21,7 @@ RSpec::Matchers.define :have_select2 do |id, options={}|
|
||||
if results.all?
|
||||
results << all_options_present(from, options[:with_options]) if options.key? :with_options
|
||||
results << exact_options_present(from, options[:options]) if options.key? :options
|
||||
results << no_options_present(from, options[:without_options]) if options.key? :without_options
|
||||
results << all_options_absent(from, options[:without_options]) if options.key? :without_options
|
||||
end
|
||||
|
||||
results.all?
|
||||
@@ -88,14 +88,6 @@ RSpec::Matchers.define :have_select2 do |id, options={}|
|
||||
end
|
||||
end
|
||||
|
||||
def no_options_present(from, options)
|
||||
with_select2_open(from) do
|
||||
options.none? do |option|
|
||||
@node.has_selector? "div.select2-drop-active ul.select2-results li", text: option
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def selected_option_is(from, text)
|
||||
within find(from) do
|
||||
find("a.select2-choice").text == text
|
||||
|
||||
Reference in New Issue
Block a user