Skip to content

Commit

Permalink
add #find_all as an alias of #all - Issue #1396
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Apr 23, 2015
1 parent 37ee1a3 commit ae1e4cb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/capybara/node/finders.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def all(*args)
result
end
end
alias_method :find_all, :all

##
#
Expand Down
10 changes: 5 additions & 5 deletions lib/capybara/session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Session
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?,
Expand Down Expand Up @@ -561,7 +561,7 @@ def accept_confirm(text_or_options=nil, options={}, &blk)
else
options[:text]=text_or_options
end

driver.accept_modal(:confirm, options, &blk)
end

Expand All @@ -577,7 +577,7 @@ def dismiss_confirm(text_or_options=nil, options={}, &blk)
else
options[:text]=text_or_options
end

driver.dismiss_modal(:confirm, options, &blk)
end

Expand All @@ -594,7 +594,7 @@ def accept_prompt(text_or_options=nil, options={}, &blk)
else
options[:text]=text_or_options
end

driver.accept_modal(:prompt, options, &blk)
end

Expand All @@ -610,7 +610,7 @@ def dismiss_prompt(text_or_options=nil, options={}, &blk)
else
options[:text]=text_or_options
end

driver.dismiss_modal(:prompt, options, &blk)
end

Expand Down
5 changes: 5 additions & 0 deletions lib/capybara/spec/session/all_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,9 @@
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

0 comments on commit ae1e4cb

Please sign in to comment.