Sha256: 09abc0f984ce9b23da4de40923fdc8f9259e0faac4074bf1442b817fa5069cdd
Contents?: true
Size: 994 Bytes
Versions: 3
Compression:
Stored size: 994 Bytes
Contents
require 'helper' describe Faraday::Response::ParseYaml do context 'when used' do let(:parse_yaml) { Faraday::Response::ParseYaml.new } it 'should load a marshalled hash' do me = parse_yaml.on_complete(:body => "--- \nname: Erik Michaels-Ober\n") me.class.should == Hash end it 'should handle hashes' do me = parse_yaml.on_complete(:body => "--- \nname: Erik Michaels-Ober\n") me['name'].should == 'Erik Michaels-Ober' end end context 'integration test' do let(:stubs) { Faraday::Adapter::Test::Stubs.new } let(:connection) do Faraday::Connection.new do |builder| builder.adapter :test, stubs builder.use Faraday::Response::ParseYaml end end it 'should create a Hash from the body' do stubs.get('/hash') {[200, {'content-type' => 'application/xml; charset=utf-8'}, "--- \nname: Erik Michaels-Ober\n"]} me = connection.get('/hash').body me.class.should == Hash end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
faraday_middleware-0.7.0 | spec/parse_yaml_spec.rb |
faraday_middleware-0.7.0.rc1 | spec/parse_yaml_spec.rb |
faraday_middleware-0.6.5 | spec/parse_yaml_spec.rb |