Sha256: c1c34ab0db194d9ed1751660ba8d5f8b5b559c473c742a5f5539b7d5e79aa868
Contents?: true
Size: 790 Bytes
Versions: 3
Compression:
Stored size: 790 Bytes
Contents
require 'tango/request/json_encoded' require 'faraday' describe Tango::Request::JsonEncoded do let(:conn) { Faraday::Connection.new do |conn| conn.use Tango::Request::JsonEncoded conn.use Faraday::Adapter::Test do |stub| stub.post '/echo' do |env| # echo back request body [ 200, {:request_body => env[:body]}, env[:body] ] end end end } context 'POST {"string":"hello"} with no content type' do let(:env) { conn.post('/echo', :string => "hello").env } it 'dumps params to JSON' do env[:response_headers]['Request-Body'].should == %q({"string":"hello"}) end it 'sets content type to application/json' do env[:request_headers]['Content-Type'].should == 'application/json' end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tango-client-1.0.2 | spec/tango/request/json_encoded_spec.rb |
tango-client-1.0.1 | spec/tango/request/json_encoded_spec.rb |
tango-client-1.0.0 | spec/tango/request/json_encoded_spec.rb |