Forces an integer to fix Issue #18

This commit is contained in:
Michael Christenson II 2009-08-27 11:54:03 -04:00
parent 5b90488f29
commit 3255c9edf0
2 changed files with 5 additions and 1 deletions

View File

@ -15,7 +15,7 @@ module Webrat
matched = matches(stringlike)
if @options[:count]
matched.size == @options[:count] && (!@block || @block.call(matched))
matched.size == @options[:count].to_i && (!@block || @block.call(matched))
else
matched.any? && (!@block || @block.call(matched))
end

View File

@ -61,6 +61,10 @@ describe "have_selector" do
@body.should have_selector("li", :count => 4)
}.should raise_error(Spec::Expectations::ExpectationNotMetError)
end
it "should convert a string to an integer for count" do
@body.should have_selector("li", :count => "3")
end
end
describe "specifying nested elements" do