mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Rename WaitUntil to timeout
This commit is contained in:
parent
42aa6615b2
commit
d7938b9cd9
5 changed files with 37 additions and 37 deletions
28
spec/timeout_spec.rb
Normal file
28
spec/timeout_spec.rb
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
||||
|
||||
require 'capybara'
|
||||
require 'capybara/timeout'
|
||||
|
||||
module Capybara
|
||||
|
||||
describe '.timeout' do
|
||||
|
||||
it "should return result of yield if it returns true value within timeout" do
|
||||
Capybara.timeout { "hello" }.should == "hello"
|
||||
end
|
||||
|
||||
it "should keep trying within timeout" do
|
||||
count = 0
|
||||
Capybara.timeout { count += 1; count == 5 ? count : nil }.should == 5
|
||||
end
|
||||
|
||||
it "should raise Capybara::TimeoutError if block fails to return true within timeout" do
|
||||
running do
|
||||
Capybara.timeout(0.1) { false }
|
||||
end.should raise_error(::Capybara::TimeoutError)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue