Sha256: 8b581a8bb892dd34fc83ab99898489052eecb8bab0658b44ec7939e22f163171

Contents?: true

Size: 640 Bytes

Versions: 4

Compression:

Stored size: 640 Bytes

Contents

# frozen_string_literal: true

require 'capybara/rspec/matchers/base'

module Capybara
  module RSpecMatchers
    module Matchers
      class HaveText < CountableWrappedElementMatcher
        def element_matches?(el)
          el.assert_text(*@args, **@kw_args)
        end

        def element_does_not_match?(el)
          el.assert_no_text(*@args, **@kw_args)
        end

        def description
          "text #{format(text)}"
        end

        def format(content)
          content.inspect
        end

      private

        def text
          @args[0].is_a?(Symbol) ? @args[1] : @args[0]
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
capybara-3.32.1 lib/capybara/rspec/matchers/have_text.rb
capybara-3.32.0 lib/capybara/rspec/matchers/have_text.rb
tdiary-5.1.1 vendor/bundle/ruby/2.7.0/gems/capybara-3.31.0/lib/capybara/rspec/matchers/have_text.rb
capybara-3.31.0 lib/capybara/rspec/matchers/have_text.rb