Sha256: 15ac1cd26e7f7571e12967e638af71b3d8ee8e5fc34cc1d0d6a3078eed5a2d8b

Contents?: true

Size: 790 Bytes

Versions: 1

Compression:

Stored size: 790 Bytes

Contents

module Capybara
  module Json
    module Dsl
      def self.included(base)
        base.extend(self)
      end

      %w[ get get! delete delete! ].each do |method|
        module_eval <<-DEF, __FILE__, __LINE__ + 1
        def #{method}(path, params = {}, env = {})
          page.driver.#{method}(path, params, env)
        end
        DEF
      end

      %w[ post post! put put! patch patch! ].each do |method|
        module_eval <<-DEF, __FILE__, __LINE__ + 1
        def #{method}(path, json, env = {})
          page.driver.#{method}(path, json, env)
        end
        DEF
      end

      %w[ raw_json json source body status_code response_headers ].each do |method|
        define_method(method) do
          page.driver.__send__(method)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capybara-json-0.4.0 lib/capybara/json/dsl.rb