From c2432fab0ba89619c0151ce6addedc1a8eb61407 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Sat, 2 Jun 2018 14:10:16 +1000 Subject: [PATCH] Use all_options_absent method instead of poorly written no_options_present SAVES 30 SECONDS FOR EVERY SPEC THAT IS IT USED IN! --- spec/support/matchers/select2_matchers.rb | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/spec/support/matchers/select2_matchers.rb b/spec/support/matchers/select2_matchers.rb index 58bfc690d8..5e57f05d73 100644 --- a/spec/support/matchers/select2_matchers.rb +++ b/spec/support/matchers/select2_matchers.rb @@ -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