diff --git a/lib/capybara/selector/filters/expression_filter.rb b/lib/capybara/selector/filters/expression_filter.rb index c5a6c74c..1c7f5b32 100644 --- a/lib/capybara/selector/filters/expression_filter.rb +++ b/lib/capybara/selector/filters/expression_filter.rb @@ -12,8 +12,11 @@ module Capybara end class IdentityExpressionFilter < ExpressionFilter - def initialize; end + def initialize(name) + super(name, nil, nil) + end def default?; false; end + def matcher?; false; end def apply_filter(expr, _name, _value); expr; end end end diff --git a/lib/capybara/selector/selector.rb b/lib/capybara/selector/selector.rb index f3786e90..94d7f775 100644 --- a/lib/capybara/selector/selector.rb +++ b/lib/capybara/selector/selector.rb @@ -223,7 +223,7 @@ module Capybara def xpath(*allowed_filters, &block) if block @format, @expression = :xpath, block - allowed_filters.flatten.each { |ef| expression_filters[ef] = Filters::IdentityExpressionFilter.new } + allowed_filters.flatten.each { |ef| expression_filters[ef] = Filters::IdentityExpressionFilter.new(ef) } end format == :xpath ? @expression : nil end