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

Decrease wait in specs time unless spec requires js

This commit is contained in:
Jonas Nicklas 2012-10-30 14:10:22 +01:00
parent b67f04e9bc
commit 1803a9f991
3 changed files with 17 additions and 12 deletions

View file

@ -1,4 +1,4 @@
Capybara::SpecHelper.spec '#asser_selector?' do
Capybara::SpecHelper.spec '#assert_selector' do
before do
@session.visit('/with_html')
end
@ -60,7 +60,7 @@ Capybara::SpecHelper.spec '#asser_selector?' do
end
end
Capybara::SpecHelper.spec '#has_no_selector?' do
Capybara::SpecHelper.spec '#assert_no_selector' do
before do
@session.visit('/with_html')
end

View file

@ -12,6 +12,21 @@ module Capybara
end
end
config.filter_run_excluding :requires => filter
config.before do
Capybara.app = TestApp
Capybara.configure do |config|
config.default_selector = :xpath
end
# set up a fast wait time so that most tests are faster
# but, if we require JS, increase it a bit.
if example.metadata[:requires] and example.metadata[:requires].include?(:js)
Capybara.default_wait_time = 1
else
Capybara.default_wait_time = 0
end
end
end
def spec(name, options={}, &block)

View file

@ -7,12 +7,6 @@ require 'rspec'
require 'capybara'
RSpec.configure do |config|
config.before do
Capybara.configure do |config|
config.default_selector = :xpath
end
end
# Workaround for http://code.google.com/p/selenium/issues/detail?id=3147:
# Rerun the example if we hit a transient "docElement is null" error
config.around(:each) do |example|
@ -32,14 +26,10 @@ end
# Required here instead of in rspec_spec to avoid RSpec deprecation warning
require 'capybara/rspec'
require 'capybara/spec/session'
alias :running :lambda
Capybara.app = TestApp
Capybara.default_wait_time = 1 # less timeout so tests run faster
module TestSessions
RackTest = Capybara::Session.new(:rack_test, TestApp)
Selenium = Capybara::Session.new(:selenium, TestApp)