Permalink
Browse files

Merge branch 'fix-app-host-reset'

  • Loading branch information...
2 parents 6a22ae8 + 5280635 commit c65a61c6a5f91c92c474056e03c69b74e6654cd1 @jnicklas jnicklas committed Nov 28, 2012
Showing with 21 additions and 20 deletions.
  1. +17 −20 lib/capybara/spec/spec_helper.rb
  2. +4 −0 spec/spec_helper.rb
@@ -9,24 +9,25 @@ module Capybara
module SpecHelper
class << self
def configure(config)
- filter = lambda do |requires, metadata|
- if requires and metadata[:skip]
- requires.any? do |require|
- metadata[:skip].include?(require)
- end
- else
- false
- end
- end
- config.filter_run_excluding :requires => filter
- config.before do
- Capybara.app = TestApp
+ config.filter_run_excluding :requires => method(:filter).to_proc
+ config.before { Capybara::SpecHelper.reset! }
+ config.after { Capybara::SpecHelper.reset! }
+ end
- Capybara.configure do |config|
- config.default_selector = :xpath
- end
+ def reset!
+ Capybara.app = TestApp
+ Capybara.app_host = nil
+ Capybara.default_selector = :xpath
+ Capybara.default_wait_time = 1
+ end
- Capybara.default_wait_time = 1
+ def filter(requires, metadata)
+ if requires and metadata[:skip]
+ requires.any? do |require|
+ metadata[:skip].include?(require)
+ end
+ else
+ false
end
end
@@ -77,8 +78,4 @@ def extract_results(session)
end
end
-RSpec.configure do |config|
- Capybara::SpecHelper.configure(config)
-end
-
Dir[File.dirname(__FILE__)+'/session/*'].each { |group| require group }
View
@@ -1 +1,5 @@
require 'capybara/spec/spec_helper'
+
+RSpec.configure do |config|
+ Capybara::SpecHelper.configure(config)
+end

0 comments on commit c65a61c

Please sign in to comment.