Skip to content

Commit

Permalink
Forces an integer to fix Issue #18
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Christenson II committed Aug 27, 2009
1 parent 5b90488 commit 3255c9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webrat/core/matchers/have_xpath.rb
Expand Up @@ -15,7 +15,7 @@ def matches?(stringlike, &block)
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
Expand Down
4 changes: 4 additions & 0 deletions spec/public/matchers/have_selector_spec.rb
Expand Up @@ -61,6 +61,10 @@
@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
Expand Down

0 comments on commit 3255c9e

Please sign in to comment.