From 9c1dd623f1f91aa1531c3db14037ab12cae79ca6 Mon Sep 17 00:00:00 2001 From: Carlos Antonio da Silva Date: Thu, 15 Nov 2012 11:18:14 -0200 Subject: [PATCH] Move the RackTest driver override to capybara/rails This change enables the `:respect_data_method` option from the RackTest driver for Rails projects that don't use RSpec. --- History.md | 8 ++++++++ lib/capybara/rails.rb | 6 +++++- lib/capybara/rspec.rb | 5 ----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/History.md b/History.md index 04238460..16921fb3 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,11 @@ +# master + +### Changed + +* Move the RackTest driver override with the `:respect_data_method` option + enabled from capybara/rspec to capybara/rails, so that it is enabled in + Rails projects that don't use RSpec. [Carlos Antonio da Silva] + # Version 2.0.0 Release date: 2012-11-05 diff --git a/lib/capybara/rails.rb b/lib/capybara/rails.rb index 27916b7e..75d101b5 100644 --- a/lib/capybara/rails.rb +++ b/lib/capybara/rails.rb @@ -4,7 +4,7 @@ require 'capybara/dsl' Capybara.app = Rack::Builder.new do map "/" do if Rails.version.to_f >= 3.0 - run Rails.application + run Rails.application else # Rails 2 use Rails::Rack::Static run ActionController::Dispatcher.new @@ -15,3 +15,7 @@ end.to_app Capybara.asset_root = Rails.root.join('public') Capybara.save_and_open_page_path = Rails.root.join('tmp/capybara') +# Override default rack_test driver to respect data-method attributes. +Capybara.register_driver :rack_test do |app| + Capybara::RackTest::Driver.new(app, :respect_data_method => true) +end diff --git a/lib/capybara/rspec.rb b/lib/capybara/rspec.rb index 4ca56036..1a917654 100644 --- a/lib/capybara/rspec.rb +++ b/lib/capybara/rspec.rb @@ -22,8 +22,3 @@ RSpec.configure do |config| end end end - -# Override default rack_test driver to respect data-method attributes. -Capybara.register_driver :rack_test do |app| - Capybara::RackTest::Driver.new(app, :respect_data_method => true) -end