Sha256: c1e373b0b050b5263d61a2411fa257121b413b88f84a7d584bb1df20849c4fcc

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 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! ].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.3.0 lib/capybara/json/dsl.rb