lib/capybara_table/rspec.rb in capybara_table-0.2.0 vs lib/capybara_table/rspec.rb in capybara_table-0.2.1
- old
+ new
@@ -8,10 +8,16 @@
have_selector(:table, caption, **options)
end
matcher :have_table_row do |fields_and_options|
fields, options = fields_and_options.partition { |k, v| k.is_a?(String) }.map(&:to_h)
- selector = Capybara::RSpecMatchers::HaveSelector.new(:table_row, fields, options)
+
+ klass = begin
+ Capybara::RSpecMatchers::Matchers::HaveSelector
+ rescue NameError
+ Capybara::RSpecMatchers::HaveSelector
+ end
+ selector = klass.new(:table_row, fields, options)
match do |node|
selector.matches?(node)
end