Sha256: 2a795c8eada0c019212eba599cbb513679f6710c50b54af92eabfbcf5d570413

Contents?: true

Size: 1.39 KB

Versions: 53

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Capybara::Selector::FilterSet do
  after do
    described_class.remove(:test)
  end

  it 'allows node filters' do
    fs = described_class.add(:test) do
      node_filter(:node_test, :boolean) { |_node, _value| true }
      expression_filter(:expression_test, :boolean) { |_expr, _value| true }
    end

    expect(fs.node_filters.keys).to include(:node_test)
    expect(fs.node_filters.keys).not_to include(:expression_test)
  end

  it 'allows expression filters' do
    fs = described_class.add(:test) do
      node_filter(:node_test, :boolean) { |_node, _value| true }
      expression_filter(:expression_test, :boolean) { |_expr, _value| true }
    end

    expect(fs.expression_filters.keys).to include(:expression_test)
    expect(fs.expression_filters.keys).not_to include(:node_test)
  end

  it 'allows node filter and expression filter with the same name' do
    fs = described_class.add(:test) do
      node_filter(:test, :boolean) { |_node, _value| true }
      expression_filter(:test, :boolean) { |_expr, _value| true }
    end

    expect(fs.expression_filters[:test]).not_to eq fs.node_filters[:test]
  end

  it 'allows `filter` as an alias of `node_filter`' do
    fs = described_class.add(:test) do
      filter(:node_test, :boolean) { |_node, _value| true }
    end

    expect(fs.node_filters.keys).to include(:node_test)
  end
end

Version data entries

53 entries across 40 versions & 5 rubygems

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