Sha256: afb331704c5eae45f70d6769d3bc93bd67b069eca2e112d10421707365654ee3

Contents?: true

Size: 892 Bytes

Versions: 67

Compression:

Stored size: 892 Bytes

Contents

# frozen_string_literal: true

Capybara::SpecHelper.spec '#have_any_of_selectors' do
  before do
    @session.visit('/with_html')
  end

  it 'should be true if any of the given selectors are on the page' do
    expect(@session).to have_any_of_selectors(:css, 'p a#foo', 'h2#blah', 'h2#h2two')
  end

  it 'should be false if none of the given selectors are not on the page' do
    expect do
      expect(@session).to have_any_of_selectors(:css, 'span a#foo', 'h2#h2nope', 'h2#h2one_no')
    end.to raise_error ::RSpec::Expectations::ExpectationNotMetError
  end

  it 'should use default selector' do
    Capybara.default_selector = :css
    expect(@session).to have_any_of_selectors('p a#foo', 'h2#h2two', 'a#not_on_page')
    expect do
      expect(@session).to have_any_of_selectors('p a#blah', 'h2#h2three')
    end.to raise_error ::RSpec::Expectations::ExpectationNotMetError
  end
end

Version data entries

67 entries across 55 versions & 3 rubygems

Version Path
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/has_any_selectors_spec.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/spec/session/has_any_selectors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.34.0/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/capybara-3.35.3/lib/capybara/spec/session/has_any_selectors_spec.rb
capybara-3.35.3 lib/capybara/spec/session/has_any_selectors_spec.rb
capybara-3.35.2 lib/capybara/spec/session/has_any_selectors_spec.rb
capybara-3.35.1 lib/capybara/spec/session/has_any_selectors_spec.rb
capybara-3.35.0 lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/capybara-3.34.0/lib/capybara/spec/session/has_any_selectors_spec.rb
capybara-3.34.0 lib/capybara/spec/session/has_any_selectors_spec.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/capybara-3.32.2/lib/capybara/spec/session/has_any_selectors_spec.rb