Repository is archived
No commit activity in last 3 years
No release in over 3 years
The unobtainium-faraday gem is a faraday-based driver implementation for unobtainium. Unlike built-in driver implementations, it does not provide a Selenium-like API, but rather one mostly identical to plain faraday.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 11.1
~> 3.4
~> 0.39
~> 0.11
~> 0.8

Runtime

>= 0.3.5, ~> 0.3
 Project Readme

unobtainium-faraday

This gem provides a driver implementation for unobtainium based on faraday.

Gem Version Build status

To use it, require it after requiring unobtainium, then create the appropriate driver:

require 'unobtainium'
require 'unobtainium-faraday'

include Unobtainium::World

drv = driver(:faraday)

The main purpose of this gem is to make API testing a little easier. To that end, the driver (which is a faraday connection object) is initialized with some middleware, in particular faraday_json to fix some encoding issues in the default middleware.

If you're coming from faraday, initializing the driver/connection is going to feel a little different. Instead of the block-initialization favoured by faraday, you pass an options hash:

drv = driver(:faraday,
             uri: 'http://finkhaeuser.de',
             connection: {
               request: :json,
               response: [:logger, [:json, content_type: /\bjson$/ ]]
             })

Afterwards, using the driver is identical to faraday usage:

res = drv.get '/'
puts res.body