Sha256: d2f30617d7639822f24588aeac788d7860b2eadfab1501ce89cf149502a5e94c

Contents?: true

Size: 645 Bytes

Versions: 40

Compression:

Stored size: 645 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
          "have 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

40 entries across 29 versions & 4 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/capybara-3.40.0/lib/capybara/rspec/matchers/have_text.rb
capybara-3.40.0 lib/capybara/rspec/matchers/have_text.rb
capybara-3.39.2 lib/capybara/rspec/matchers/have_text.rb
capybara-3.39.1 lib/capybara/rspec/matchers/have_text.rb
capybara-3.39.0 lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/have_text.rb
capybara-3.38.0 lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/capybara-3.37.1/lib/capybara/rspec/matchers/have_text.rb
capybara-3.37.1 lib/capybara/rspec/matchers/have_text.rb
capybara-3.37.0 lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/have_text.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/rspec/matchers/have_text.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/have_text.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/capybara-3.36.0/lib/capybara/rspec/matchers/have_text.rb
capybara-3.36.0 lib/capybara/rspec/matchers/have_text.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/rspec/matchers/have_text.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/rspec/matchers/have_text.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/rspec/matchers/have_text.rb