Permalink
Browse files

compatibility for capybara < 1.0

  • Loading branch information...
1 parent a66869d commit 0c4034c4aa4cbc43ecab3bbd5756901be9f0cbd7 @okitan committed Dec 10, 2011
Showing with 13 additions and 7 deletions.
  1. +2 −2 .gitignore
  2. 0 .rvmrc
  3. +1 −0 .rvmrc.capybara.lt.1.0
  4. +2 −2 .travis.yml
  5. +5 −1 lib/capybara/json.rb
  6. +3 −2 lib/capybara/rack_test_json/driver.rb
View
@@ -1,4 +1,4 @@
-*.gem
+0;136;0c*.gem
.bundle
-Gemfile.lock
+Gemfile*.lock
pkg/*
View
0 .rvmrc 100644 → 100755
No changes.
View
@@ -0,0 +1 @@
+rvm gemset use capybara.lt.1.0-json
View
@@ -1,8 +1,8 @@
rvm:
- - 1.8.7
+# - 1.8.7
- 1.9.2
- 1.9.3
- ruby-head
gemfile:
- Gemfile
-# - Gemfile.capybara.lt.1.0
+ - Gemfile.capybara.lt.1.0
View
@@ -3,8 +3,12 @@
module Capybara
module Json
+ def self.to_include
+ Capybara.const_defined?("DSL") ? Capybara::DSL : Capybara
+ end
+
def self.included(base)
- base.__send__(:include, Capybara::DSL) unless base < Capybara or base < Capybara::DSL
+ base.__send__(:include, to_include) unless base < to_include
base.extend(self)
end
@@ -1,10 +1,11 @@
require 'multi_json'
-class Capybara::RackTestJson::Driver < Capybara::RackTest::Driver
+to_inherit = Capybara.const_defined?("RackTest") ? Capybara::RackTest::Driver : Capybara::Driver::RackTest
+
+class Capybara::RackTestJson::Driver < to_inherit
def body
MultiJson.decode(source) || {}
end
-
%w[ post put ].each do |method|
class_eval %{

0 comments on commit 0c4034c

Please sign in to comment.