mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #782 from ineverov/size_instead_of_count
Use size instead of count
This commit is contained in:
commit
5c79469259
1 changed files with 3 additions and 3 deletions
|
@ -19,14 +19,14 @@ module Capybara
|
||||||
end
|
end
|
||||||
|
|
||||||
def find!
|
def find!
|
||||||
raise find_error if @result.count != 1
|
raise find_error if @result.size != 1
|
||||||
@result.first
|
@result.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_error
|
def find_error
|
||||||
if @result.count == 0
|
if @result.size == 0
|
||||||
Capybara::ElementNotFound.new("Unable to find #{@query.description}")
|
Capybara::ElementNotFound.new("Unable to find #{@query.description}")
|
||||||
elsif @result.count > 1
|
elsif @result.size > 1
|
||||||
Capybara::Ambiguous.new("Ambiguous match, found #{size} elements matching #{@query.description}")
|
Capybara::Ambiguous.new("Ambiguous match, found #{size} elements matching #{@query.description}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue