Sha256: 4bcf0337419db3bc1521e4f5830b88a16fca53a991bcd89ee8251619a07ac100

Contents?: true

Size: 1.72 KB

Versions: 44

Compression:

Stored size: 1.72 KB

Contents

# frozen_string_literal: true

require 'capybara/rspec/matchers/base'

module Capybara
  module RSpecMatchers
    module Matchers
      class HaveSelector < WrappedElementMatcher
        def element_matches?(el)
          el.assert_selector(*@args, &@filter_block)
        end

        def element_does_not_match?(el)
          el.assert_no_selector(*@args, &@filter_block)
        end

        def description
          "have #{query.description}"
        end

        def query
          @query ||= Capybara::Queries::SelectorQuery.new(*session_query_args, &@filter_block)
        end
      end

      class HaveAllSelectors < WrappedElementMatcher
        def element_matches?(el)
          el.assert_all_of_selectors(*@args, &@filter_block)
        end

        def does_not_match?(_actual)
          raise ArgumentError, 'The have_all_selectors matcher does not support use with not_to/should_not'
        end

        def description
          'have all selectors'
        end
      end

      class HaveNoSelectors < WrappedElementMatcher
        def element_matches?(el)
          el.assert_none_of_selectors(*@args, &@filter_block)
        end

        def does_not_match?(_actual)
          raise ArgumentError, 'The have_none_of_selectors matcher does not support use with not_to/should_not'
        end

        def description
          'have no selectors'
        end
      end

      class HaveAnySelectors < WrappedElementMatcher
        def element_matches?(el)
          el.assert_any_of_selectors(*@args, &@filter_block)
        end

        def does_not_match?(_actual)
          el.assert_none_of_selectors(*@args, &@filter_block)
        end

        def description
          'have any selectors'
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 3 rubygems

Version Path
isomorfeus-puppetmaster-0.5.7 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.6 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.5 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.4 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.3 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.2 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.1 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.5.0 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.4.1 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.4.0 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.5 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.4 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.3 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.2 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.1 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.3.0 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.2.9 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.2.8 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.2.7 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb
isomorfeus-puppetmaster-0.2.6 lib/isomorfeus/puppetmaster/rspec/matchers/have_selector.rb