From ae1e4cb088dbede2f9fac91474f4a931ef026e01 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Thu, 23 Apr 2015 11:11:57 -0700 Subject: [PATCH] add #find_all as an alias of #all - Issue #1396 --- lib/capybara/node/finders.rb | 1 + lib/capybara/session.rb | 10 +++++----- lib/capybara/spec/session/all_spec.rb | 5 +++++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/capybara/node/finders.rb b/lib/capybara/node/finders.rb index 0aca3c70..70465594 100644 --- a/lib/capybara/node/finders.rb +++ b/lib/capybara/node/finders.rb @@ -153,6 +153,7 @@ module Capybara result end end + alias_method :find_all, :all ## # diff --git a/lib/capybara/session.rb b/lib/capybara/session.rb index 21b75980..b91084cc 100644 --- a/lib/capybara/session.rb +++ b/lib/capybara/session.rb @@ -27,7 +27,7 @@ module Capybara NODE_METHODS = [ :all, :first, :attach_file, :text, :check, :choose, :click_link_or_button, :click_button, :click_link, :field_labeled, - :fill_in, :find, :find_button, :find_by_id, :find_field, :find_link, + :fill_in, :find, :find_all, :find_button, :find_by_id, :find_field, :find_link, :has_content?, :has_text?, :has_css?, :has_no_content?, :has_no_text?, :has_no_css?, :has_no_xpath?, :resolve, :has_xpath?, :select, :uncheck, :has_link?, :has_no_link?, :has_button?, :has_no_button?, :has_field?, @@ -561,7 +561,7 @@ module Capybara else options[:text]=text_or_options end - + driver.accept_modal(:confirm, options, &blk) end @@ -577,7 +577,7 @@ module Capybara else options[:text]=text_or_options end - + driver.dismiss_modal(:confirm, options, &blk) end @@ -594,7 +594,7 @@ module Capybara else options[:text]=text_or_options end - + driver.accept_modal(:prompt, options, &blk) end @@ -610,7 +610,7 @@ module Capybara else options[:text]=text_or_options end - + driver.dismiss_modal(:prompt, options, &blk) end diff --git a/lib/capybara/spec/session/all_spec.rb b/lib/capybara/spec/session/all_spec.rb index 7c9ceb7d..532b39ab 100644 --- a/lib/capybara/spec/session/all_spec.rb +++ b/lib/capybara/spec/session/all_spec.rb @@ -149,4 +149,9 @@ Capybara::SpecHelper.spec "#all" do end end end + + it "should have #find_all as an alias" do + expect(Capybara::Node::Finders.instance_method(:all)).to eq Capybara::Node::Finders.instance_method(:find_all) + expect(@session.find_all('//p').size).to eq(3) + end end