1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Merge branch 'cast_text_to_string' of git://github.com/abotalov/capybara into abotalov-cast_text_to_string

This commit is contained in:
Jonas Nicklas 2013-03-26 16:52:26 +01:00
parent 23c1be75b3
commit 5c1229acf9
3 changed files with 9 additions and 1 deletions

View file

@ -37,7 +37,7 @@ module Capybara
def matches_filters?(node)
if options[:text]
regexp = options[:text].is_a?(Regexp) ? options[:text] : Regexp.escape(options[:text])
regexp = options[:text].is_a?(Regexp) ? options[:text] : Regexp.escape(options[:text].to_s)
return false if not node.text(visible).match(regexp)
end
case visible

View file

@ -27,6 +27,12 @@ Capybara::SpecHelper.spec '#find' do
@session.find(:css, "a#has-been-clicked").text.should include('Has been clicked')
end
context "with :text option" do
it "casts text's argument to string" do
expect { @session.find(:css, '.number', text: 42) }.to_not raise_error
end
end
context "with :wait option", :requires => [:js] do
it "should not wait for asynchronous load when `false` given" do
@session.visit('/with_js')

View file

@ -8,6 +8,8 @@
<h2 class="head">Header Class Test Four</h2>
<h2 class="head">Header Class Test Five</h2>
<span class="number">42</span>
<p class="para" id="first">
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut <a href="/with_simple_html" title="awesome title" class="simple">labore</a>