Sha256: 35a8ea1ef9ab8533c5c3792f99872c8d3c21060754cffa08afff2b9e7268d0d2
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
require 'capybara' require 'capybara/dsl' require 'multi_json' module Capybara module Json def self.to_include Capybara.const_defined?("DSL") ? Capybara::DSL : Capybara end def self.included(base) base.__send__(:include, to_include) unless base < to_include base.extend(self) end %w[ get delete ].each do |method| module_eval %{ def #{method}(path, params = {}, env = {}) page.driver.#{method}(path, params, env) end } end %w[ post put ].each do |method| module_eval %{ def #{method}(path, json, env = {}) page.driver.#{method}(path, json, env) end } end autoload :Error, 'capybara/json/error' end module RackTestJson autoload :Driver, 'capybara/rack_test_json/driver' end module HTTPClientJson autoload :Driver, 'capybara/httpclient_json/driver' end end Capybara.register_driver :rack_test_json do |app| Capybara::RackTestJson::Driver.new(app) end Capybara.register_driver :httpclient_json do |app| Capybara::HTTPClientJson::Driver.new(app) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-json-0.1.1 | lib/capybara/json.rb |