From d7fa508b60bb4cddd9e07caf8f13e19dbaf74843 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 24 Feb 2023 15:19:54 +1100 Subject: [PATCH] Remove unused matcher have_flash_message --- .../matchers/flash_message_matchers.rb | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 spec/support/matchers/flash_message_matchers.rb diff --git a/spec/support/matchers/flash_message_matchers.rb b/spec/support/matchers/flash_message_matchers.rb deleted file mode 100644 index 8d2f1febb1..0000000000 --- a/spec/support/matchers/flash_message_matchers.rb +++ /dev/null @@ -1,33 +0,0 @@ -# frozen_string_literal: true - -RSpec::Matchers.define :have_flash_message do |message| - match do |node| - @message, @node = message, node - - # Ignore leading and trailing whitespace. Later versions of Capybara have :exact_text option. - # The :exact option is not supported in has_selector?. - message_substring_regex = substring_match_regex(message) - node.has_selector?(".flash", text: message_substring_regex, visible: false) - end - - failure_message do |_actual| - "expected to find flash message ##{@message}" - end - - match_when_negated do |node| - @message, @node = message, node - - # Ignore leading and trailing whitespace. Later versions of Capybara have :exact_text option. - # The :exact option is not supported in has_selector?. - message_substring_regex = substring_match_regex(message) - node.has_no_selector?(".flash", text: message_substring_regex, visible: false) - end - - failure_message_when_negated do |_actual| - "expected not to find flash message ##{@message}" - end - - def substring_match_regex(text) - /\A\s*#{Regexp.escape(text)}\s*\Z/ - end -end