Sha256: de5ec627f6edf3660578b900d374304e3b3417ecc42d1e7a91dceebbc252fe49
Contents?: true
Size: 610 Bytes
Versions: 1
Compression:
Stored size: 610 Bytes
Contents
require 'multi_json' class Capybara::RackTestJson::Driver < Capybara::RackTest::Driver def body MultiJson.decode(source) || {} end %w[ post put ].each do |method| class_eval %{ def #{method}(path, json, env = {}) json = MultiJson.encode(json) unless json.is_a?(String) request_env = { 'CONTENT_LENGTH' => json.size, 'CONTENT_TYPE' => "application/json; charset=\#{json.encoding.to_s.downcase}", 'rack.input' => StringIO.new(json) }.merge(env) super(path, {}, request_env) end } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
capybara-json-0.0.1 | lib/capybara/rack_test_json/driver.rb |