Skip to content

Commit

Permalink
Capybara#default_wait_time
Browse files Browse the repository at this point in the history
Capybara default_wait_time
- should default to 2 seconds
- should be changeable
  • Loading branch information
Lenny Marks committed Dec 31, 2009
1 parent af81f74 commit eb82466
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/capybara.rb
Expand Up @@ -8,14 +8,20 @@ class CapybaraError < StandardError; end
class DriverNotFoundError < CapybaraError; end
class ElementNotFound < CapybaraError; end
class NotSupportedByDriverError < CapybaraError; end

class TimeoutError < CapybaraError; end

class << self
attr_accessor :debug, :asset_root, :app_host
attr_writer :default_selector
attr_writer :default_selector, :default_wait_time


def default_selector
@default_selector ||= :xpath
end

def default_wait_time
@default_wait_time ||= 2
end

def log(message)
puts "[capybara] #{message}" if debug
Expand Down
22 changes: 22 additions & 0 deletions spec/capybara_spec.rb
@@ -0,0 +1,22 @@
require File.expand_path('spec_helper', File.dirname(__FILE__))

require 'capybara'

describe Capybara do

describe 'default_wait_time' do
after do
Capybara.default_wait_time = 2
end

it "should default to 2 seconds" do
Capybara.default_wait_time.should == 2
end

it "should be changeable" do
Capybara.default_wait_time = 5
Capybara.default_wait_time.should == 5
end
end

end

0 comments on commit eb82466

Please sign in to comment.