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:
parent
23c1be75b3
commit
5c1229acf9
3 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Reference in a new issue